(function() {
  Snmon.Default = {
    Load: function() {
      var me = this;
      Ext.create("Ext.Viewport", {
        minWidth: 1e3,
        minHeight: 500,
        layout: "border",
        items: [me.West(), me.Center(), {
          region: "south",
          border: !1,
          autoHeight: !0,
          html: '<div id="footer" style="width: 100%; text-align: center">&nbsp;&nbsp;&nbsp; All Right Reserved<\/div>',
          tbar: {
            margin: "2 0 2 20",
            items: ["操作员: ", Snmon.UserName, "-", "角色: ", Snmon.Role, "-", "登录时间: ", Snmon.CurDate, "->", {
              xtype: "button",
              text: "修改密码",
              handler: me.EditPassWord,
              scope: me
            }, {
              xtype: "button",
              text: "安全退出",
              handler: me.SafeClose,
              scope: me
            }]
          }
        }]
      }), Util.AddTab("C878677F-95D5-437A-903E-1E155B99445B", "Section.aspx"), window.onunload = me.BeforeSafeClose, this.Delay()
    },
    West: function() {
      var items = [];
      return Ext.each(Snmon.PrimaryNavigation, function(item, index) {
        items.push(this.Business(item, index))
      }, this), {
        region: "west",
        layout: "accordion",
        title: "",
        collapsible: !0,
        split: !0,
        width: 180,
        minWidth: 150,
        maxWidth: 500,
        items: items
      }
    },
    Center: function() {
      return {
        id: "MainPage",
        region: "center",
        layout: "border",
        border: !1,
        items: [{
          region: "center",
          layout: "fit",
          border: !1,
          items: this.TabPanel()
        }]
      }
    },
    Business: function(item, index) {
      return {
        title: item.名称,
        layout: "fit",
        items: Snmon.tree.Tree({
          autoLoad: index == 0,
          id: item.名称,
          minWidth: 200,
          maxWidth: 500,
          rootVisible: !1,
          bodyStyle: {
            "border-left": 0,
            "border-right": 0
          },
          TopBarStyle: {
            "border-left": 0,
            "border-right": 0,
            "border-top": 0
          },
          boName: "导航目录",
          extraParams: {
            sign: "FindTree",
            treeBoName: "导航目录",
            page: "Default",
            expandHandler: !0,
            depth: 0
          },
          sort: !1,
          rootId: item.ID,
          rootText: item.名称,
          itemclick: this.OnTreeClick
        })
      }
    },
    TabPanel: function() {
      return top.mainContainer = Ext.create("Ext.tab.Panel", {
        id: "MainContainer",
        layout: "fit",
        resizeTabs: !0,
        enableTabScroll: !0,
        frame: !1,
        bodyStyle: "0px",
        bodyPadding: 1,
        bodyBorder: !0,
        defaults: {
          autoScroll: !0
        },
        listeners: {
          tabchange: function() {
            Ext.ComponentManager.each(function(item) {
              var component = Ext.getCmp(item);
              component && component.xtype == "window" && component.hide()
            })
          }
        },
        items: [],
        plugins: Ext.create("Ext.ux.TabCloseMenu")
      })
    },
    OnTreeClick: function(view, record, item, index, e) {
      e.stopEvent();
      var raw = record.raw;
      raw.url && raw.url.toLowerCase().indexOf("aspx/") == -1 ? Util.AddTab(raw.id, raw.url, raw.text) : open(raw.url)
    },
    SafeClose: function() {
      window.confirm("确认安全退出?") && (this.BeforeSafeClose("SafetyExit"), location.replace(Config.VPath + "Login.aspx"))
    },
    Delay: function() {
      setInterval(function() {
        Ext.Ajax.request({
          method: "POST",
          url: Config.VPath + "WebServices/LoginOrDefaultHandler.ashx",
          params: {
            sign: "Delay"
          },
          success: function() {},
          failure: function() {}
        })
      }, 311111)
    },
    EditPassWord: function() {
      var WindowEditPwd = Ext.getCmp("WindowEditPwd");
      WindowEditPwd || (WindowEditPwd = Ext.create("Ext.window.Window", {
        id: "WindowEditPwd",
        title: "修改密码",
        height: 165,
        width: 280,
        constrainHeader: !0,
        layout: "border",
        closable: !1,
        resizable: !1,
        modal: Config.modal,
        items: [Ext.create("Ext.FormPanel", {
          id: "PwdPanel",
          region: "north",
          cols: 1,
          height: 400,
          canEditor: !0,
          config: !1,
          bodyStyle: "border:0px;margin-bottom:15px;",
          boName: "用户",
          items: [Ext.create("Ext.form.TextField", {
            id: "UserName",
            fieldLabel: "用户名",
            labelWidth: 60,
            width: 200,
            allowBlank: !1,
            readOnly: !0,
            dataType: "string",
            value: Snmon.UserName
          }), Ext.create("Ext.form.TextField", {
            id: "PassWord0",
            fieldLabel: "原密码",
            labelWidth: 60,
            width: 200,
            inputType: "password",
            allowBlank: !1,
            readOnly: !1,
            dataType: "string"
          }), Ext.create("Ext.form.TextField", {
            id: "PassWord1",
            fieldLabel: "密码",
            labelWidth: 60,
            width: 200,
            inputType: "password",
            allowBlank: !1,
            readOnly: !1,
            dataType: "string"
          }), Ext.create("Ext.form.TextField", {
            id: "PassWord2",
            fieldLabel: "确认密码",
            labelWidth: 60,
            width: 200,
            inputType: "password",
            allowBlank: !1,
            readOnly: !1,
            dataType: "string"
          })]
        })],
        bbar: ["->", {
          text: "保存",
          iconCls: "icon-save",
          handler: Snmon.Default.SavePassWord
        }, {
          text: "取消",
          iconCls: "icon-cancel",
          handler: function() {
            WindowEditPwd.hide()
          }
        }]
      })), WindowEditPwd.show()
    },
    SavePassWord: function() {
      var pwd0 = Ext.getCmp("PassWord0").getValue().trim(),
        pwd1 = Ext.getCmp("PassWord1").getValue().trim(),
        pwd2 = Ext.getCmp("PassWord2").getValue().trim(),
        mask;
      if (!pwd0) {
        Msg.Normal("原密码不能为空！");
        return
      }
      if (pwd1 && pwd2) {
        if (pwd1 != pwd2) {
          Msg.Normal("密码和确认密码不一致！");
          return
        }
        if (pwd0 == pwd1) {
          Msg.Normal("新密码和原密码不能相同！");
          return
        }
        mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "保存中,请稍等..."
        }), mask.show(), Ext.Ajax.request({
          url: "/WebServices/LoginOrDefaultHandler.ashx",
          params: {
            PassWord0: pwd0,
            PassWord1: pwd1,
            sign: "EditPassword"
          },
          success: function(r) {
            mask.hide(), r.status == 200 && (Ext.getCmp("WindowEditPwd").hide(), Msg.Normal(r.responseText))
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      } else {
        Msg.Normal("密码或确认密码为空！");
        return
      }
    },
    BeforeSafeClose: function(type) {
      Snmon && Snmon.service.Synch("WebServices/LoginOrDefaultHandler.ashx?sign=SafeClose&state=" + type), Ext.cache = {}, Snmon = null, Util = null
    }
  }
})(),
function() {
  Snmon.Section = {
    "审批自动默认刷新时间": 3e4,
    "通知自动默认刷新时间": 3e4,
    TodoStore: null,
    CompleteStore: null,
    AlreadyDoUnfinishedStore: null,
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Date: function() {},
    Render: {
      Init: function() {
        var tab = top.mainContainer.getActiveTab();
        tab.setTitle("首页"), tab.add(this.Panel()), top.mask.hide()
      },
      Panel: function() {
        return {
          region: "center",
          layout: "border",
          bodyStyle: "border:0px;",
          close: !1,
          items: [{
            region: "center",
            layout: "column",
            bodyStyle: "border:0px;",
            autoScroll: !0,
            border: !1,
            defaults: {
              layout: "anchor",
              defaults: {
                anchor: "100%"
              }
            },
            items: [{
              columnWidth: 1 / 2,
              border: !1,
              bodyStyle: "padding:5px 0 5px 5px",
              items: [{
                title: "",
                bodyStyle: "padding:5px",
                height: 200,
                autoScroll: !0,
                tbar: ['<font style="font-weight:bold;color:#04408c;">待办事项<\/font>', "->", {
                  xtype: "button",
                  text: "查看",
                  handler: function() {
                    Util.AddTab("C878677F-95D5-437A-903E-1E155B994451", "BaseViews/SectionViews/Todo.aspx")
                  }
                }, {
                  xtype: "button",
                  text: "刷新",
                  iconCls: "icon-refresh",
                  id: "ButtonSectionTodoRefresh",
                  handler: function() {
                    var store = Snmon.Section.TodoStore || Ext.data.StoreManager.lookup(Util.id("Store_Todo"));
                    store && store.load()
                  }
                }],
                items: this.TodoView()
              }, {
                title: "",
                bodyStyle: "padding:5px",
                height: 200,
                autoScroll: !0,
                tbar: ['<font style="font-weight:bold;color:#04408c;">已办事项<\/font>', "->", {
                  xtype: "button",
                  text: "查看",
                  handler: function() {
                    Util.AddTab("C878677F-95D5-437A-903E-1E155B994452", "BaseViews/SectionViews/Complete.aspx")
                  }
                }, {
                  xtype: "button",
                  text: "刷新",
                  iconCls: "icon-refresh",
                  id: "ButtonSectionCompleteRefresh",
                  handler: function() {
                    var store = Snmon.Section.CompleteStore || Ext.data.StoreManager.lookup(Util.id("Store_Complete"));
                    store && store.load()
                  }
                }],
                items: this.CompleteView()
              }]
            }, {
              columnWidth: 1 / 2,
              bodyStyle: "padding:5px",
              border: !1,
              items: [{
                title: "",
                bodyStyle: "padding:5px",
                height: 200,
                autoScroll: !0,
                tbar: ['<font style="font-weight:bold;color:#04408c;">已办未完<\/font>', "->", {
                  xtype: "button",
                  text: "查看",
                  handler: function() {
                    Util.AddTab("C878677F-95D5-437A-903E-1E155B994453", "BaseViews/SectionViews/AlreadyDoUnfinished.aspx")
                  }
                }, {
                  xtype: "button",
                  text: "刷新",
                  iconCls: "icon-refresh",
                  id: "ButtonSectionAlreadyDoUnfinishedRefresh",
                  handler: function() {
                    var store = Snmon.Section.AlreadyDoUnfinishedStore || Ext.data.StoreManager.lookup(Util.id("Store_AlreadyDoUnfinished"));
                    store && store.load()
                  }
                }],
                items: this.AlreadyDoUnfinishedView()
              }, {
                title: "",
                bodyStyle: "padding:5px",
                height: 200,
                autoScroll: !0,
                tbar: ['<font style="font-weight:bold;color:#04408c;">通 知<\/font>', "->", {
                  xtype: "button",
                  text: "查看",
                  handler: function() {
                    Util.AddTab("C878677F-95D5-437A-903E-1E155B994454", "BaseViews/DocumentViews/DocumentList.aspx")
                  }
                }, {
                  xtype: "button",
                  text: "刷新",
                  iconCls: "icon-refresh",
                  handler: function() {
                    var store = Ext.data.StoreManager.lookup(Util.id("Store_CommonNotice"));
                    store && store.load()
                  }
                }],
                items: this.CommonNoticeView()
              }]
            }]
          }]
        }
      },
      TodoView: function() {
        var store = Snmon.data.Store({
            id: "Todo",
            autoLoad: !0,
            url: "WebServices/Section.ashx",
            boName: "单据待审记录",
            extraParams: {
              sign: "GetTodo"
            },
            items: [{
              fieldLabel: "ID"
            }, {
              fieldLabel: "单据ID"
            }, {
              fieldLabel: "单据摘要"
            }, {
              fieldLabel: "单据类型"
            }, {
              fieldLabel: "单据类型别名"
            }, {
              fieldLabel: "是否查看数据"
            }]
          }),
          imageTpl;
        return Snmon.Section.TodoStore = store, imageTpl = new Ext.XTemplate('<tpl for=".">', '<div style="margin-bottom: 10px;" class="thumb-wrap">', "{#}. <a href=\"javascript:void(0)\" style=\"color:red;text-decoration:none;\" onclick=\"Snmon.Section.Event.Goto('{单据类型}','{单据ID}','待办事项',{是否查看数据},'{单据摘要}');\">{单据类型别名}{单据摘要}<\/a>", "<\/div>", "<\/tpl>"), Ext.create("Ext.view.View", {
          store: store,
          tpl: imageTpl,
          minHeight: 165,
          loadMask: !1,
          itemSelector: "div.thumb-wrap"
        })
      },
      AlreadyDoUnfinishedView: function() {
        var store = Snmon.data.Store({
            id: "AlreadyDoUnfinished",
            autoLoad: !0,
            url: "WebServices/Section.ashx",
            boName: "单据审批记录",
            extraParams: {
              sign: "GetAlreadyDoUnfinished"
            },
            items: [{
              fieldLabel: "ID"
            }, {
              fieldLabel: "单据ID"
            }, {
              fieldLabel: "单据摘要"
            }, {
              fieldLabel: "单据类型"
            }, {
              fieldLabel: "单据类型别名"
            }]
          }),
          imageTpl;
        return Snmon.Section.AlreadyDoUnfinishedStore = store, imageTpl = new Ext.XTemplate('<tpl for=".">', '<div style="margin-bottom: 10px;" class="thumb-wrap">', "{#}. <a href=\"javascript:void(0)\" style=\"color:orange;text-decoration:none;\" onclick=\"Snmon.Section.Event.Goto('{单据类型}','{单据ID}','已办未完');\">{单据类型别名}{单据摘要}<\/a>", "<\/div>", "<\/tpl>"), Ext.create("Ext.view.View", {
          store: store,
          tpl: imageTpl,
          minHeight: 165,
          loadMask: !1,
          itemSelector: "div.thumb-wrap"
        })
      },
      CompleteView: function() {
        var store = Snmon.data.Store({
            id: "Complete",
            autoLoad: !0,
            url: "WebServices/Section.ashx",
            boName: "单据审批记录",
            extraParams: {
              sign: "GetComplete"
            },
            items: [{
              fieldLabel: "ID"
            }, {
              fieldLabel: "单据ID"
            }, {
              fieldLabel: "单据摘要"
            }, {
              fieldLabel: "单据类型"
            }, {
              fieldLabel: "单据类型别名"
            }]
          }),
          imageTpl;
        return Snmon.Section.CompleteStore = store, imageTpl = new Ext.XTemplate('<tpl for=".">', '<div style="margin-bottom: 10px;" class="thumb-wrap">', "{#}. <a href=\"javascript:void(0)\" style=\"color:green;text-decoration:none;\" onclick=\"Snmon.Section.Event.Goto('{单据类型}','{单据ID}','已办事项');\">{单据类型别名}{单据摘要}<\/a>", "<\/div>", "<\/tpl>"), Ext.create("Ext.view.View", {
          store: store,
          tpl: imageTpl,
          minHeight: 165,
          loadMask: !1,
          itemSelector: "div.thumb-wrap"
        })
      },
      CommonNoticeView: function() {
        var store = Snmon.data.Store({
            id: "CommonNotice",
            autoLoad: !0,
            url: "WebServices/Section.ashx",
            boName: "文档",
            extraParams: {
              sign: "GetNotice",
              type: "公共通知"
            },
            items: [{
              fieldLabel: "ID"
            }, {
              fieldLabel: "标题"
            }, {
              fieldLabel: "发布时间"
            }, {
              fieldLabel: "发文部门",
              xtype: "object"
            }, {
              fieldLabel: "发布人员",
              xtype: "object"
            }]
          }),
          imageTpl = new Ext.XTemplate('<tpl for=".">', '<div style="margin-bottom: 10px;" class="thumb-wrap">', '{#}. <a href="javascript:void(0)" onclick="Snmon.Section.Event.GotoNotice(\'{ID}\');">[{文档分类.名称}]{标题} - {发布时间} - {发布人员.名称} - {发文部门.名称}<\/a>', "<\/div>", "<\/tpl>");
        return Ext.create("Ext.view.View", {
          store: store,
          tpl: imageTpl,
          minHeight: 165,
          loadMask: !1,
          itemSelector: "div.thumb-wrap"
        })
      }
    },
    Common: {},
    Event: {
      BeforeEvent: {
        Init: function() {},
        Button: {
          Init: function() {}
        },
        Grid: {
          Init: function() {}
        },
        Store: {
          Init: function() {}
        }
      },
      AfterEvent: {
        Init: function() {
          setInterval(function() {
            var storeTodo = Ext.data.StoreManager.lookup(Util.id("Store_Todo")),
              storeAlreadyDoUnfinished, storeComplete;
            storeTodo && storeTodo.load(), storeAlreadyDoUnfinished = Ext.data.StoreManager.lookup(Util.id("Store_AlreadyDoUnfinished")), storeAlreadyDoUnfinished && storeAlreadyDoUnfinished.load(), storeComplete = Ext.data.StoreManager.lookup(Util.id("Store_Complete")), storeComplete && storeComplete.load()
          }, Snmon.Section.审批自动默认刷新时间), setInterval(function() {
            var storeCommonNotice = Ext.data.StoreManager.lookup(Util.id("Store_CommonNotice")),
              storeDepartmentNotice, storeConferenceNotice;
            storeCommonNotice && storeCommonNotice.load(), storeDepartmentNotice = Ext.data.StoreManager.lookup(Util.id("Store_DepartmentNotice")), storeDepartmentNotice && storeDepartmentNotice.load(), storeConferenceNotice = Ext.data.StoreManager.lookup(Util.id("Store_ConferenceNotice")), storeConferenceNotice && storeConferenceNotice.load()
          }, Snmon.Section.通知自动默认刷新时间)
        }
      },
      Goto: function(boName, id, type, isShow, content) {
        var _暂存, vals, url;
        if (boName) {
          if (boName == "月度计划商品分配" && type == "待办事项") {
            if (_暂存 = Snmon.service.Synch("WebServices/Section.ashx", {
                sign: "GetHoldById",
                boName: boName,
                id: id
              }) == "true", !_暂存) {
              Url.GotoEditPage(this, "OperationViews/SalesViews/DealerMonthlyPlanEdit.aspx", "经销商月度计划", 1, null, {
                planId: id
              });
              return
            }
          } else boName == "采购检验单" && isShow && (vals = content.split(":"), vals = vals[0].split("-"), Url.GotoPage(this, "OperationViews/Purchase/PurchaseOrderList.aspx", {
            id: id,
            boName: boName,
            PurchaseNo: vals[0],
            Item: vals[2],
            Remove: !0
          }));
          url = Snmon.service.GetUrlByBoName(boName), url && Url.GotoEditPage(id, url, boName, 4, id)
        }
      },
      GotoNotice: function(id) {
        Url.GotoEditPage(id, "BaseViews/DocumentViews/DocumentEdit.aspx", "文档", 4, id)
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.DataImportManager = {
    Load: function() {
      Snmon.DataImportManager.Methods = ["全部"], ListPage.Render({
        RemoveButtons: ["Add", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "Query", "History", "Export"]
      }), this.Render.Init()
    },
    Render: {
      Init: function() {
        var toolbar;
        toolbar = Util.getCmp("Toolbar"), toolbar.insert(0, {
          xtype: "button",
          iconCls: "icon-guide",
          text: "导入清单",
          menu: {
            items: [{
              text: "供应商导入",
              config: {
                boName: "供应商导入"
              },
              handler: Snmon.DataImport
            }, {
              text: "测试导入",
              config: {
                boName: "物料关系导入"
              },
              handler: Snmon.DataImport
            }]
          }
        })
      }
    }
  }
}(),
function() {
  Snmon.CompanyList = {
    Load: function() {
      ListPage.Render({
        items: "",
        ShowQuery: !1
      });
      var grid = Util.getCmp("Grid");
      grid.store.loadPage(1)
    }
  }
}(),
function() {
  Snmon.CustomerEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.CustomerList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "BaseViews/BaseViews/CustomerEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientlistedit", this.OnListEdit, this)
        },
        OnListEdit: function() {
          var panel, btnSave;
          panel = Util.getCmp("Panel");
          panel.on("clientload", this.OnLoad, this);
          btnSave = Util.getCmp("ButtonSubmit"), btnSave && btnSave.on("clientbeforeclick", this.OnBeforeClickSave, this)
        },
        OnBeforeClickSave: function() {
          var _往来类别Cmp;
          return _往来类别Cmp = Util.getPCmp("往来类别"), _往来类别Cmp && (_往来类别Cmp.往来类别 = _往来类别Cmp.getValue()), !0
        },
        OnLoad: function() {
          var pageState, _往来类别Cmp;
          pageState = Util.GetPageState(), pageState == 1 && (_往来类别Cmp = Util.getPCmp("往来类别"), _往来类别Cmp && _往来类别Cmp.往来类别 && _往来类别Cmp.setValue(_往来类别Cmp.往来类别))
        }
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.DepartMentList = {
    Load: function() {
      ListPage.Render({
        items: "BaseViews/BaseViews/DepartMentEdit.aspx",
        ShowQuery: !1
      });
      var grid = Util.getCmp("Grid");
      grid.store.loadPage(1)
    }
  }
}(),
function() {
  Snmon.DevelopmentStandardsEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {
          var _子表Cmp;
          _子表Cmp = Util.getCmp("GridDetails_开发标准类型"), _子表Cmp && (_子表Cmp.events.clientfilteralreadyselect = !0)
        }
      }
    }
  }
}(),
function() {
  Snmon.DevelopmentStandardsList = {
    Load: function() {
      ListPage.Render({
        items: "BaseViews/BaseViews/DevelopmentStandardsEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      })
    }
  }
}(),
function() {
  Snmon.DevelopmentStandardsTypesList = {
    Load: function() {
      ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0
      })
    }
  }
}(),
function() {
  Snmon.EmployeeList = {
    Load: function() {
      ListPage.Render({
        items: "BaseViews/BaseViews/EmployeeEdit.aspx",
        ShowQuery: !1
      });
      var grid = Util.getCmp("Grid");
      grid.store.loadPage(1)
    }
  }
}(),
function() {
  Snmon.InspectionStandardEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.InspectionStandardList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "BaseViews/BaseViews/InspectionStandardEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.MaterialRelationList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1
      });
      var grid = Util.getCmp("Grid");
      grid.store.loadPage(1)
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientlistedit", this.OnListEdit, this)
        },
        OnListEdit: function() {
          var _保存Cmp = Util.getCmp("ButtonSubmit");
          _保存Cmp.on("clientbeforepackclick", this.BeforePackclick, this)
        },
        BeforePackclick: function() {
          var _物料组Cmp, _公司编号Cmp, _物料组, _公司编号, grid, result;
          if (grid = Util.GetHeadID(), _物料组Cmp = Util.getPCmp("物料组"), _公司编号Cmp = Util.getPCmp("公司编号"), _物料组 = _物料组Cmp.getValue(), _公司编号 = _公司编号Cmp.getValue(), _物料组 && _公司编号) {
            if (result = Snmon.service.Synch("WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx", {
                sign: "MaterialRelation",
                material: _物料组,
                company: _公司编号,
                ID: grid
              }), result == "OK") return Msg.Normal("公司编号:" + _公司编号 + ",物料组:" + _物料组 + ",已存在!"), !1
          } else return Msg.Normal("请填写必填信息"), !1
        },
        After: {
          Init: function() {}
        }
      }
    }
  }
}(),
function() {
  Snmon.MaterialTypeList = {
    Load: function() {
      ListPage.Render({
        items: "BaseViews/BaseViews/MaterialTypeEdit.aspx",
        ShowQuery: !1
      });
      var grid = Util.getCmp("Grid");
      grid.store.loadPage(1)
    }
  }
}(),
function() {
  Snmon.OrdersToSuppliersInvoiceEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Event.After.Init(), Snmon.OrdersToSuppliersInvoiceEdit.UrlQuery ? this.Params = Ext.urlDecode(Snmon.OrdersToSuppliersInvoiceEdit.UrlQuery) : delete this.Params
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {
          var panel = Util.getCmp("Panel"),
            gridd, _折扣金额Cmp;
          panel.on("clientload", this.OnLoad, this);
          gridd = Util.getCmp("GridD");
          gridd.store.on("add", this.On更新开票金额, this);
          gridd.store.on("update", this.On更新开票金额, this);
          gridd.store.on("remove", this.On更新开票金额, this);
          gridd.on("edit", this.On更新开票金额, this);
          if (_折扣金额Cmp = Util.getPCmp("折扣金额"), _折扣金额Cmp) _折扣金额Cmp.on("blur", this.On更新金额, this)
        },
        OnLoad: function() {
          var params, _供应商Cmp, _总金额Cmp, _折扣后总金额Cmp, gridd;
          _供应商Cmp = Util.getPCmp("供应商"), params = Snmon.OrdersToSuppliersInvoiceEdit.Params, _供应商Cmp && params.JLJH && (_供应商Cmp.clientdata = {
            ID: params.gysId,
            "名称": params.company
          }, _供应商Cmp.setValue(params.company)), _总金额Cmp = Util.getPCmp("总金额"), _折扣后总金额Cmp = Util.getPCmp("折扣后总金额"), Util.GetPageState() == 1 && (gridd = Util.getCmp("GridD"), _总金额Cmp.setValue(gridd.store.sum("折扣后总金额")), _折扣后总金额Cmp.setValue(gridd.store.sum("折扣后总金额")))
        },
        "On更新开票金额": function(editor, e) {
          var field, record, _折扣金额, _开票金额, _总金额, _折扣后总金额, _入库订单;
          field = e.field, record = e.record, ["总金额", "折扣金额", "开票金额", "折扣后总金额", "入库订单"].indexOf(field) != -1 && (_折扣金额 = record.get("折扣金额") || 0, _开票金额 = record.get("开票金额") || 0, _总金额 = record.get("总金额") || 0, _折扣后总金额 = record.get("折扣后总金额") || 0, _入库订单 = record.get("入库订单"), _折扣金额 >= 0 && _折扣金额 <= _总金额 ? (_折扣后总金额 = Number.FloatSubt(_总金额, _折扣金额), record.set("折扣后总金额", _折扣后总金额)) : (record.set("折扣金额", ""), Msg.Normal("折扣金额不能大于总金额或小于0")), _开票金额 != 0 && (_开票金额 > _折扣后总金额 || _开票金额 < 0) && (record.set("开票金额", ""), Msg.Normal("开票金额不能大于折扣后总金额或小于0")));
          var _总金额Cmp = Util.getPCmp("总金额"),
            _折扣后总金额Cmp = Util.getPCmp("折扣后总金额"),
            _折扣金额Cmp = Util.getPCmp("折扣金额"),
            gridd = Util.getCmp("GridD"),
            _总金额TB = gridd.store.sum("折扣后总金额");
          _总金额Cmp.setValue(_总金额TB), _折扣后总金额Cmp.setValue(_总金额TB - _折扣金额Cmp.getValue())
        },
        "On更新金额": function() {
          var _折扣后总金额Cmp = Util.getPCmp("折扣后总金额"),
            _总金额Cmp = Util.getPCmp("总金额"),
            _折扣金额Cmp = Util.getPCmp("折扣金额"),
            _总金额 = _总金额Cmp.getValue(),
            _折扣金额 = _折扣金额Cmp.getValue();
          _折扣金额 <= _总金额 && _折扣金额 >= 0 ? _折扣后总金额Cmp.setValue(_总金额 - _折扣金额) : (_折扣金额Cmp.setValue(""), Msg.Normal("折扣金额不能大于总金额或小于0"))
        }
      },
      Service: {
        "判断开票金额": function(入库订单, _开票金额, _折扣金额) {
          var mask;
          mask = new Ext.LoadMask(Ext.getBody(), {
            msg: "处理中,请稍等..."
          }), mask.show(), Ext.Ajax.request({
            timeout: Config.timeout,
            url: Config.VPath + "WebServices/Operation/OperationViews/OrdersToSuppliersInvoiceHandler.ashx",
            method: "POST",
            params: {
              sign: "PDKPJE",
              RKDD: 入库订单,
              KPJE: _开票金额,
              JKJE: _折扣金额
            },
            success: function(r) {
              mask.hide();
              var data = Ext.decode(r.responseText);
              result.msg != "OK" && Msg.Normal("开票金额不能大于折扣后的总金额")
            },
            failure: function(r) {
              mask.hide(), Msg.Failure(r.responseText)
            }
          })
        }
      }
    }
  }
}(),
function() {
  Snmon.OrdersToSuppliersInvoiceList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "BaseViews/BaseViews/OrdersToSuppliersInvoiceEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PriceListEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.PriceListList = {
    Load: function() {
      ListPage.Render({
        items: "BaseViews/BaseViews/PriceListEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      })
    }
  }
}(),
function() {
  Snmon.ProcurementOperationPermissions = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: " ",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.SendTextingEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var toolbar;
        toolbar = Util.getCmp("Toolbar"), toolbar.insert(3, {
          id: Util.id("ButtonFS"),
          xtype: "button",
          text: "发送"
        })
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {
          var btnDC;
          btnDC = Util.getCmp("ButtonFS"), btnDC && btnDC.on("click", this.On发送短信, this)
        },
        "On发送短信": function() {
          var panle, _发送号码Cmp, _发送内容Cmp, _发送号码, _发送内容;
          panle = Util.getCmp("Panel"), _发送号码Cmp = Util.getPanelCmp("发送号码"), _发送内容Cmp = Util.getPanelCmp("发送的内容"), _发送号码 = _发送号码Cmp.getValue(), _发送内容 = _发送内容Cmp.getValue(), _发送号码 != "" && _发送内容 != "" ? Snmon.SendTextingEdit.Service.发送短信(_发送号码, _发送内容) : Msg.Normal("发送号码或发送的内容不能为空!")
        }
      }
    },
    Service: {
      "发送短信": function(_发送号码, _发送内容) {
        var mask;
        mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "处理中,请稍等..."
        }), mask.show(), Ext.Ajax.request({
          timeout: Config.timeout,
          method: "POST",
          url: Config.VPath + "WebServices/Operation/OperationViews/SendTextingHandler.ashx",
          params: {
            sign: "SendData",
            phone: _发送号码,
            text: _发送内容
          },
          success: function(r) {
            var obj = Ext.decode(r.responseText),
              btnSubmit;
            obj.success && (Msg.Normal("发送成功"), mask.hide(), btnSubmit = Util.getCmp("ButtonSubmit"), btnSubmit.fireEvent("click", btnSubmit))
          },
          failure: function(r) {
            Msg.Normal("发送失败"), mask.hide(), Msg.Failure(r.responseText)
          }
        })
      }
    }
  }
}(),
function() {
  Snmon.SendTextingList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "BaseViews/BaseViews/SendTextingEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {},
        OnLoad: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.SupplierDevelopmentApplicationEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforelayout", this.OnBeforeLayout, this)
        },
        OnBeforeLayout: function(items) {
          var panel, form, gridUpload, gridSupplierRequest, gridMaterialRequirements;
          return form = Util.getCmp("Panel"), gridSupplierRequest = Util.getCmp("GridSupplierRequest"), gridMaterialRequirements = Util.getCmp("GridMaterialRequirements"), panel = {
            region: "center",
            layout: "border",
            bodyStyle: "border:0px;",
            items: []
          }, items.push(panel), Ext.apply(form, {
            region: "north",
            autoScroll: !0,
            split: !0,
            minHeight: 60
          }), gridUpload = Ext.create("Ext.ux.UploadPanel", {
            id: Util.id("GridAttachment"),
            title: "附件",
            boName: "产品规格附件"
          }), panel.items.push({
            id: Util.id("TabForm"),
            xtype: "tabpanel",
            region: "center",
            bodyStyle: "border-top:0px;",
            split: !0,
            minHeight: 150,
            items: [gridSupplierRequest, gridMaterialRequirements, gridUpload]
          }), panel.items.push(form), !1
        }
      },
      After: {
        Init: function() {
          var panel = Util.getCmp("Panel");
          panel.on("clientbeforesave", this.OnBeforeSave, this);
          panel.on("clientbuttoncontrol", this.OnControl, this);
          panel.on("clientload", this.OnLoad, this)
        },
        OnBeforeSave: function(config) {
          var grid = Util.getCmp("GridAttachment"),
            store = grid.store,
            items = [],
            noUpload = 0,
            headId = Util.GetHeadID();
          return store.each(function(item) {
            if (item.get("status") == -4) {
              var _版本戳 = item.raw.版本戳;
              items.push({
                ID: item.get("ID"),
                "头表ID": headId,
                "附件大小": item.get("附件大小"),
                "附件路径": item.get("附件路径"),
                "附件名称": item.get("附件名称"),
                "附件说明": item.get("附件说明"),
                "附件后缀": item.get("附件后缀"),
                "上传时间": item.get("上传时间"),
                "操作状态ID": _版本戳 ? Config.Modify : Config.Add,
                "版本戳": _版本戳
              })
            } else noUpload++
          }), Ext.isArray(config.data[config.boName]) ? config.data[config.boName][0].附件列表 = items : config.data[config.boName].附件列表 = items, noUpload > 0 ? (Msg.Normal("有附件需要上传,请处理"), !1) : void 0
        },
        OnControl: function(data, _记录权限) {
          var grid = Util.getCmp("GridAttachment");
          _记录权限 ? grid.setDisabled(!_记录权限.修改) : grid.setDisabled(!data.BoPower.添加)
        },
        OnLoad: function(data) {
          if (data.GridAttachment) {
            var grid = Util.getCmp("GridAttachment");
            Ext.each(data.GridAttachment[grid.boName], function(item) {
              item.percent = 100, item.status = -4, item.name = item.附件名称
            }), grid.store.loadRawData(data.GridAttachment[grid.boName])
          }
        }
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.SupplierDevelopmentApplicationList = {
    Load: function() {
      ListPage.Render({
        items: "BaseViews/BaseViews/SupplierDevelopmentApplicationEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      })
    }
  }
}(),
function() {
  Snmon.SupplierDevelopmentBusinessRecordsEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforelayout", this.OnBeforeLayout, this)
        },
        OnBeforeLayout: function(items) {
          var panel, form, gridUpload;
          return form = Util.getCmp("Panel"), panel = {
            region: "center",
            layout: "border",
            bodyStyle: "border:0px;",
            items: []
          }, items.push(panel), Ext.apply(form, {
            region: "north",
            autoScroll: !0,
            split: !0,
            minHeight: 60
          }), gridUpload = Ext.create("Ext.ux.UploadPanel", {
            id: Util.id("GridAttachment"),
            title: "附件",
            boName: "洽谈记录附件"
          }), panel.items.push({
            id: Util.id("TabForm"),
            xtype: "tabpanel",
            region: "center",
            bodyStyle: "border-top:0px;",
            split: !0,
            minHeight: 150,
            items: [gridUpload]
          }), panel.items.push(form), !1
        }
      },
      After: {
        Init: function() {
          var panel = Util.getCmp("Panel");
          panel.on("clientbeforesave", this.OnBeforeSave, this);
          panel.on("clientbuttoncontrol", this.OnControl, this);
          panel.on("clientload", this.OnLoad, this)
        },
        OnBeforeSave: function(config) {
          var grid = Util.getCmp("GridAttachment"),
            store = grid.store,
            items = [],
            noUpload = 0,
            headId = Util.GetHeadID();
          return store.each(function(item) {
            if (item.get("status") == -4) {
              var _版本戳 = item.raw.版本戳;
              items.push({
                ID: item.get("ID"),
                "头表ID": headId,
                "附件大小": item.get("附件大小"),
                "附件路径": item.get("附件路径"),
                "附件名称": item.get("附件名称"),
                "附件说明": item.get("附件说明"),
                "附件后缀": item.get("附件后缀"),
                "上传时间": item.get("上传时间"),
                "操作状态ID": _版本戳 ? Config.Modify : Config.Add,
                "版本戳": _版本戳
              })
            } else noUpload++
          }), Ext.isArray(config.data[config.boName]) ? config.data[config.boName][0].附件列表 = items : config.data[config.boName].附件列表 = items, noUpload > 0 ? (Msg.Normal("有附件需要上传,请处理"), !1) : void 0
        },
        OnControl: function(data, _记录权限) {
          var grid = Util.getCmp("GridAttachment");
          _记录权限 ? grid.setDisabled(!_记录权限.修改) : grid.setDisabled(!data.BoPower.添加)
        },
        OnLoad: function(data) {
          if (data.GridAttachment) {
            var grid = Util.getCmp("GridAttachment");
            Ext.each(data.GridAttachment[grid.boName], function(item) {
              item.percent = 100, item.status = -4, item.name = item.附件名称
            }), grid.store.loadRawData(data.GridAttachment[grid.boName])
          }
        }
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.SupplierDevelopmentBusinessRecordsList = {
    Load: function() {
      ListPage.Render({
        items: "BaseViews/BaseViews/SupplierDevelopmentBusinessRecordsEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      })
    }
  }
}(),
function() {
  Snmon.SupplierDevelopmentProcessEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {
          var _需求申请单Cmp;
          _需求申请单Cmp = Util.getPCmp("需求申请单"), _需求申请单Cmp && _需求申请单Cmp.on("select", this.On判断需求申请单是否存在, this)
        },
        "On判断需求申请单是否存在": function() {
          var _需求申请单Cmp, _需求申请单ID;
          _需求申请单Cmp = Util.getPCmp("需求申请单"), _需求申请单Cmp && (_需求申请单Cmp.xtype == "display" ? _需求申请单ID = _需求申请单Cmp.clientdata.ID : _需求申请单Cmp = _需求申请单Cmp.getValue()), _需求申请单ID && Snmon.SingleVehicleMonthlyRebatePolicyEdit.Service.判断需求申请单是否存在(_需求申请单ID)
        }
      }
    },
    Service: {
      "判断需求申请单是否存在": function(_需求申请单ID) {
        var mask, _头表ID;
        mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "处理中,请稍等..."
        }), mask.show(), _头表ID = Util.GetHeadID(), Ext.Ajax.request({
          timeout: Config.timeout,
          method: "POST",
          url: Config.VPath + "WebServices/Operation/OperationViews/SupplierDevelopmentProcessHandler.ashx",
          params: {
            sign: "JudgeTheData",
            id: _需求申请单ID,
            HeadId: _头表ID
          },
          success: function(r) {
            var obj = Ext.decode(r.responseText);
            if (obj.success) {
              Ext.MessageBox.confirm("提示", "这个需求申请单的开发过程记录单已存在,是否修改已存在的单子?", callback);

              function callback(id) {
                if (id == "yes") {
                  var invoicesId = Ext.decode(r.responseText);
                  Url.GotoEditPage(invoicesId.ID[0].ID, "BaseViews/BaseViews/SupplierDevelopmentProcessEdit.aspx", "供应商开发过程记录单", 4, invoicesId.ID[0].ID)
                }
              }
            }
            mask.hide()
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          }
        })
      }
    }
  }
}(),
function() {
  Snmon.SupplierDevelopmentProcessList = {
    Load: function() {
      ListPage.Render({
        items: "BaseViews/BaseViews/SupplierDevelopmentProcessEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      })
    }
  }
}(),
function() {
  Snmon.SupplierOfficialContractSignedEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforelayout", this.OnBeforeLayout, this)
        },
        OnBeforeLayout: function(items) {
          var panel, form, gridUpload, gridDetail;
          return form = Util.getCmp("Panel"), gridDetail = Util.getCmp("GridDetail"), panel = {
            region: "center",
            layout: "border",
            bodyStyle: "border:0px;",
            items: []
          }, items.push(panel), Ext.apply(form, {
            region: "north",
            autoScroll: !0,
            split: !0,
            minHeight: 60
          }), gridUpload = Ext.create("Ext.ux.UploadPanel", {
            id: Util.id("GridAttachment"),
            title: "附件",
            boName: "正式合同记录附件"
          }), panel.items.push({
            id: Util.id("TabForm"),
            xtype: "tabpanel",
            region: "center",
            bodyStyle: "border-top:0px;",
            split: !0,
            minHeight: 150,
            items: [gridDetail, gridUpload]
          }), panel.items.push(form), !1
        }
      },
      After: {
        Init: function() {
          var panel = Util.getCmp("Panel"),
            _开始时间Cmp, _结束时间Cmp, _供应商Cmp;
          panel.on("clientbeforesave", this.OnBeforeSave, this);
          panel.on("clientbuttoncontrol", this.OnControl, this);
          panel.on("clientload", this.OnLoad, this);
          if (_开始时间Cmp = Util.getCmp("GridDetail_起始日期"), _结束时间Cmp = Util.getCmp("GridDetail_结束日期"), _开始时间Cmp && _开始时间Cmp.on("change", function() {
              Snmon.RealTimeUpdate.OnSetMinTime(_开始时间Cmp, _结束时间Cmp)
            }, Snmon.RealTimeUpdate), _结束时间Cmp && _结束时间Cmp.on("change", function() {
              Snmon.RealTimeUpdate.OnSetMaxTime(_结束时间Cmp, _开始时间Cmp)
            }, Snmon.RealTimeUpdate), _供应商Cmp = Util.getPCmp("供应商"), _供应商Cmp) _供应商Cmp.on("clientvalue", this.On供应商Value, this)
        },
        OnBeforeSave: function(config) {
          var grid = Util.getCmp("GridAttachment"),
            store = grid.store,
            items = [],
            noUpload = 0,
            headId = Util.GetHeadID();
          return store.each(function(item) {
            if (item.get("status") == -4) {
              var _版本戳 = item.raw.版本戳;
              items.push({
                ID: item.get("ID"),
                "头表ID": headId,
                "附件大小": item.get("附件大小"),
                "附件路径": item.get("附件路径"),
                "附件名称": item.get("附件名称"),
                "附件说明": item.get("附件说明"),
                "附件后缀": item.get("附件后缀"),
                "上传时间": item.get("上传时间"),
                "操作状态ID": _版本戳 ? Config.Modify : Config.Add,
                "版本戳": _版本戳
              })
            } else noUpload++
          }), Ext.isArray(config.data[config.boName]) ? config.data[config.boName][0].附件列表 = items : config.data[config.boName].附件列表 = items, noUpload > 0 ? (Msg.Normal("有附件需要上传,请处理"), !1) : void 0
        },
        OnControl: function(data, _记录权限) {
          var grid = Util.getCmp("GridAttachment");
          _记录权限 ? grid.setDisabled(!_记录权限.修改) : grid.setDisabled(!data.BoPower.添加)
        },
        OnLoad: function(data) {
          if (data.GridAttachment) {
            var grid = Util.getCmp("GridAttachment");
            Ext.each(data.GridAttachment[grid.boName], function(item) {
              item.percent = 100, item.status = -4, item.name = item.附件名称
            }), grid.store.loadRawData(data.GridAttachment[grid.boName])
          }
        },
        "On供应商Value": function(el, records) {
          var _签订地址Cmp = Util.getPCmp("签订地址");
          _签订地址Cmp.setValue(records[0].raw.联系人1地址)
        }
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.SupplierOfficialContractSignedList = {
    Load: function() {
      ListPage.Render({
        items: "BaseViews/BaseViews/SupplierOfficialContractSignedEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      })
    }
  }
}(),
function() {
  Snmon.SupplierTrialContractSignedEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforelayout", this.OnBeforeLayout, this)
        },
        OnBeforeLayout: function(items) {
          var panel, form, gridUpload, gridDetail;
          return form = Util.getCmp("Panel"), gridDetail = Util.getCmp("GridDetail"), panel = {
            region: "center",
            layout: "border",
            bodyStyle: "border:0px;",
            items: []
          }, items.push(panel), Ext.apply(form, {
            region: "north",
            autoScroll: !0,
            split: !0,
            minHeight: 60
          }), gridUpload = Ext.create("Ext.ux.UploadPanel", {
            id: Util.id("GridAttachment"),
            title: "附件",
            boName: "试用合同记录附件"
          }), panel.items.push({
            id: Util.id("TabForm"),
            xtype: "tabpanel",
            region: "center",
            bodyStyle: "border-top:0px;",
            split: !0,
            minHeight: 150,
            items: [gridDetail, gridUpload]
          }), panel.items.push(form), !1
        }
      },
      After: {
        Init: function() {
          var panel = Util.getCmp("Panel"),
            _供应商Cmp;
          panel.on("clientbeforesave", this.OnBeforeSave, this);
          panel.on("clientbuttoncontrol", this.OnControl, this);
          panel.on("clientload", this.OnLoad, this);
          if (_供应商Cmp = Util.getPCmp("供应商"), _供应商Cmp) _供应商Cmp.on("clientvalue", this.On供应商Value, this)
        },
        OnBeforeSave: function(config) {
          var grid = Util.getCmp("GridAttachment"),
            store = grid.store,
            items = [],
            noUpload = 0,
            headId = Util.GetHeadID();
          return store.each(function(item) {
            if (item.get("status") == -4) {
              var _版本戳 = item.raw.版本戳;
              items.push({
                ID: item.get("ID"),
                "头表ID": headId,
                "附件大小": item.get("附件大小"),
                "附件路径": item.get("附件路径"),
                "附件名称": item.get("附件名称"),
                "附件说明": item.get("附件说明"),
                "附件后缀": item.get("附件后缀"),
                "上传时间": item.get("上传时间"),
                "操作状态ID": _版本戳 ? Config.Modify : Config.Add,
                "版本戳": _版本戳
              })
            } else noUpload++
          }), Ext.isArray(config.data[config.boName]) ? config.data[config.boName][0].附件列表 = items : config.data[config.boName].附件列表 = items, noUpload > 0 ? (Msg.Normal("有附件需要上传,请处理"), !1) : void 0
        },
        OnControl: function(data, _记录权限) {
          var grid = Util.getCmp("GridAttachment");
          _记录权限 ? grid.setDisabled(!_记录权限.修改) : grid.setDisabled(!data.BoPower.添加)
        },
        OnLoad: function(data) {
          if (data.GridAttachment) {
            var grid = Util.getCmp("GridAttachment");
            Ext.each(data.GridAttachment[grid.boName], function(item) {
              item.percent = 100, item.status = -4, item.name = item.附件名称
            }), grid.store.loadRawData(data.GridAttachment[grid.boName])
          }
        },
        "On供应商Value": function() {
          var _签订地址Cmp = Util.getPCmp("签订地址");
          _签订地址Cmp.setValue("records[0].raw.联系人1地址")
        }
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.SupplierTrialContractSignedList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "BaseViews/BaseViews/SupplierTrialContractSignedEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.AlreadyDoUnfinished = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        RemoveButtons: ["Add", "Delete", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "Query", "History", "Export"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var store = Util.getCmp("Grid").store;
        store.proxy.url = "/WebServices/Section.ashx", store.setExtraParams("sign", "FindAlreadyDoUnfinished"), store.load()
      }
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", function(config) {
            config.multiSelect = !1
          })
        }
      },
      After: {
        Init: function() {
          var grid, btnView;
          btnView = Util.getCmp("ButtonView"), btnView && btnView.on("clientbeforeclick", this.OnView), grid = Util.getCmp("Grid");
          grid.on("itemdblclick", this.OnView)
        },
        OnView: function() {
          var selected = Util.getCmp("Grid").selModel.getLastSelected(),
            boName, url, id;
          return selected && (boName = selected.raw.单据类型, boName && (url = Snmon.service.GetUrlByBoName(boName), url && (id = selected.raw.单据ID, Url.GotoEditPage(id, url, boName, 4, id)))), !1
        }
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.Complete = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        RemoveButtons: ["Add", "Delete", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "Query", "History", "Export"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var store = Util.getCmp("Grid").store;
        store.proxy.url = "/WebServices/Section.ashx", store.setExtraParams("sign", "FindComplete"), store.load()
      }
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", function(config) {
            config.multiSelect = !1
          })
        }
      },
      After: {
        Init: function() {
          var btnView, grid;
          btnView = Util.getCmp("ButtonView"), btnView && btnView.on("clientbeforeclick", this.OnView), grid = Util.getCmp("Grid");
          grid.on("itemdblclick", this.OnView)
        },
        OnView: function() {
          var selected = Util.getCmp("Grid").selModel.getLastSelected(),
            boName, url, id;
          return selected && (boName = selected.raw.单据类型, boName && (url = Snmon.service.GetUrlByBoName(boName), url && (id = selected.raw.单据ID, Url.GotoEditPage(id, url, boName, 4, id)))), !1
        }
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.Todo = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        RemoveButtons: ["Add", "Delete", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "Query", "History", "Export"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var store = Util.getCmp("Grid").store;
        store.proxy.url = "/WebServices/Section.ashx", store.setExtraParams("sign", "FindTodo"), store.load()
      }
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", function(config) {
            config.multiSelect = !1
          })
        }
      },
      After: {
        Init: function() {
          var btnView, grid;
          btnView = Util.getCmp("ButtonView"), btnView && btnView.on("clientbeforeclick", this.OnView), grid = Util.getCmp("Grid");
          grid.on("itemdblclick", this.OnView)
        },
        OnView: function() {
          var selected = Util.getCmp("Grid").selModel.getLastSelected(),
            boName, url, id;
          return selected && (boName = selected.raw.单据类型, boName && (url = Snmon.service.GetUrlByBoName(boName), url && (id = selected.raw.单据ID, Url.GotoEditPage(id, url, boName, 4, id)))), !1
        }
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.ComponentConfig = {
    Load: function() {
      this.Event.Before.Init(), this.Render.Init(), this.Event.After.Init(), this.Service.GetConfig()
    },
    Render: {
      Init: function() {
        var buttonEvent = Snmon.ComponentConfig.Event.Button,
          search = Util.getTabUrlSearch(),
          ctype = Util.getTabUrlSearch().cType,
          p, g;
        this.groupConfigType = this.configTypeConfigType = this.widthConfigType = this.heightConfigType = "展示", this.editorConfigType = this.rowSpanConfigType = this.colSpanConfigType = this.sumConfigType = "展示", this.defaultWidthConfigType = this.colConfigType = this.ftypeConfigType = this.groupFieldConfigType = "展示", this.compareSignConfigType = this.isRegionConfigType = this.labelWidthConfigType = "展示", ctype == "常用条件" || ctype == "Silverlight常用条件" ? (this.groupConfigType = this.configTypeConfigType = this.heightConfigType = "展示隐藏", this.editorConfigType = this.rowSpanConfigType = this.colSpanConfigType = this.sumConfigType = "展示隐藏", this.colConfigType = this.ftypeConfigType = this.groupFieldConfigType = "展示隐藏", ctype == "Silverlight常用条件" && (this.cnameConfigType = "展示")) : ctype == "表单" || ctype == "Silverlight表单" ? (this.compareSignConfigType = this.isRegionConfigType = this.sumConfigType = "展示隐藏", this.ftypeConfigType = this.groupFieldConfigType = this.cnameConfigType = "展示隐藏") : (ctype == "列表" || ctype == "Silverlight列表") && (this.groupConfigType = this.compareSignConfigType = this.rowSpanConfigType = this.colSpanConfigType = this.isRegionConfigType = "展示隐藏", this.labelWidthConfigType = this.colConfigType = this.cnameConfigType = "展示隐藏"), p = this.GetForm(), g = this.GetGrid(), Util.AddMainPanel([p, g], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: buttonEvent.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonField"),
          text: "字段",
          iconCls: "icon-select",
          handler: buttonEvent.OnFieldClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }, {
          componentType: "button",
          id: Util.id("ButtonHelp"),
          text: "帮助",
          iconCls: "icon-help",
          handler: Util.OperateHelp
        }], Ext.String.format("({0}|{1})", search.boName, search.cName)), Snmon.control.FormEditor(p, !0)
      },
      GetForm: function() {
        return Snmon.formTable.Form({
          id: "Panel",
          region: "north",
          cols: 6,
          height: 35,
          canEditor: !0,
          config: !1,
          bodyStyle: "border-bottom:0px;margin-bottom:15px;",
          boName: "控件配置",
          items: [{
            fieldLabel: "容器类型",
            labelWidth: 60,
            width: 120,
            dataType: "string",
            componentType: "显示控件"
          }, {
            fieldLabel: "默认宽度",
            labelWidth: 60,
            width: 100,
            dataType: "int",
            allowBlank: !1,
            minValue: 60,
            maxValue: 2e3,
            componentType: "数值控件",
            configType: this.defaultWidthConfigType,
            defaultValue: 160,
            step: 5
          }, {
            fieldLabel: "标签宽度",
            labelWidth: 60,
            width: 100,
            allowBlank: !0,
            dataType: "int",
            minValue: 50,
            maxValue: 120,
            componentType: "数值控件",
            configType: this.labelWidthConfigType,
            step: 5
          }, {
            fieldLabel: "列数",
            labelWidth: 60,
            width: 100,
            allowBlank: !0,
            dataType: "int",
            minValue: 1,
            maxValue: 10,
            componentType: "数值控件",
            configType: this.colConfigType
          }, {
            fieldLabel: "汇总类型",
            labelWidth: 60,
            width: 100,
            dataType: "string",
            allowBlank: !0,
            componentType: "下拉扩展控件",
            store: Snmon.Sums,
            model: "local",
            editable: !1,
            forceSelection: !0,
            triggerAction: "all",
            value: Snmon.Sums[0],
            configType: this.ftypeConfigType
          }, {
            fieldLabel: "分组字段",
            labelWidth: 60,
            width: 100,
            allowBlank: !0,
            dataType: "string",
            componentType: "文本控件",
            configType: this.groupFieldConfigType
          }, {
            fieldLabel: "控件名称",
            labelWidth: 60,
            width: 120,
            allowBlank: !0,
            dataType: "string",
            componentType: "文本控件",
            configType: this.cnameConfigType
          }]
        })
      },
      GetGrid: function() {
        return Snmon.grid.Grid({
          id: "Grid",
          region: "center",
          config: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !0,
          boName: "控件配置属性信息",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性类型名",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "数据类型",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性类型显示属性",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "顺序",
            width: 70,
            dataType: "int",
            allowBlank: !1,
            componentType: "数值控件",
            decimalPrecision: 0,
            defaultValue: 0,
            step: 100
          }, {
            fieldLabel: "字段名",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "控件类型",
            width: 100,
            dataType: "string",
            allowBlank: !1,
            editable: !1,
            componentType: "下拉扩展控件",
            store: Snmon.Components,
            model: "local",
            defaultValue: Snmon.Components[1]
          }, {
            fieldLabel: "别名",
            width: 100,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件",
            defaultValue: ""
          }, {
            fieldLabel: "分组",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件",
            configType: this.groupConfigType,
            defaultValue: ""
          }, {
            fieldLabel: "宽度",
            width: 60,
            dataType: "int",
            allowBlank: !1,
            componentType: "数值控件",
            decimalPrecision: 0,
            defaultValue: 0,
            configType: this.widthConfigType,
            step: 5
          }, {
            fieldLabel: "必填",
            width: 55,
            dataType: "boolean",
            defaultValue: !1
          }, {
            fieldLabel: "默认值",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件",
            defaultValue: "",
            renderer: function(value, metaData, record) {
              var vals, data, showProperty, i, ln;
              if (value && (value.indexOf("{") == 0 || value.indexOf("[{") == 0)) {
                if (data = Ext.decode(value), showProperty = record.get("属性类型显示属性"), Ext.isArray(data)) {
                  for (vals = [], i = 0, ln = data.lenght; i < ln; i++) vals.push(data[i][showProperty]);
                  return vals.join(",")
                }
                return data[showProperty]
              }
              return value
            }
          }, {
            fieldLabel: "高度",
            width: 60,
            dataType: "int",
            allowBlank: !0,
            componentType: "数值控件",
            decimalPrecision: 0,
            configType: this.heightConfigType
          }, {
            fieldLabel: "编辑类型",
            width: 70,
            dataType: "string",
            allowBlank: !0,
            editable: !1,
            componentType: "下拉扩展控件",
            store: Snmon.Editors,
            model: "local",
            defaultValue: Snmon.Editors[0],
            configType: this.editorConfigType
          }, {
            fieldLabel: "比较符",
            width: 70,
            dataType: "string",
            allowBlank: !0,
            editable: !1,
            componentType: "下拉扩展控件",
            store: ["包含", "不包含", "==", "!=", ">", ">=", "<", "<="],
            model: "local",
            configType: this.compareSignConfigType,
            defaultValue: ""
          }, {
            fieldLabel: "行合并",
            width: 60,
            dataType: "int",
            allowBlank: !0,
            componentType: "数值控件",
            decimalPrecision: 0,
            configType: this.rowSpanConfigType
          }, {
            fieldLabel: "列合并",
            width: 60,
            dataType: "int",
            allowBlank: !0,
            componentType: "数值控件",
            decimalPrecision: 0,
            configType: this.colSpanConfigType
          }, {
            fieldLabel: "格式化",
            width: 80,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件",
            defaultValue: ""
          }, {
            fieldLabel: "小数位数",
            width: 60,
            dataType: "int",
            allowBlank: !0,
            componentType: "数值控件",
            decimalPrecision: 0
          }, {
            fieldLabel: "校验类型",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件",
            defaultValue: ""
          }, {
            fieldLabel: "校验类型文本",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件"
          }, {
            fieldLabel: "汇总类型",
            width: 70,
            dataType: "string",
            allowBlank: !0,
            editable: !1,
            componentType: "下拉扩展控件",
            store: ["记录数", "合计", "平均", "最小", "最大"],
            model: "local",
            defaultValue: ""
          }, {
            fieldLabel: "汇总类型文本",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件",
            defaultValue: ""
          }, {
            fieldLabel: "可合计",
            width: 60,
            dataType: "boolean",
            defaultValue: !1,
            configType: this.sumConfigType
          }, {
            fieldLabel: "最大字符",
            width: 80,
            dataType: "int",
            allowBlank: !0,
            componentType: "数值控件",
            decimalPrecision: 0
          }, {
            fieldLabel: "最小值",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件",
            decimalPrecision: 0
          }, {
            fieldLabel: "最大值",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件",
            decimalPrecision: 0
          }, {
            fieldLabel: "来源属性",
            width: 80,
            decimalPrecision: 0,
            dataType: "string",
            allowBlank: !0,
            editable: !1,
            componentType: "下拉扩展控件",
            store: [],
            model: "local",
            configType: this.configTypeConfigType
          }, {
            fieldLabel: "多选",
            width: 60,
            dataType: "boolean",
            defaultValue: !1
          }, {
            fieldLabel: "区间",
            width: 60,
            dataType: "boolean",
            defaultValue: !1,
            configType: this.isRegionConfigType
          }, {
            fieldLabel: "配置类型",
            width: 80,
            decimalPrecision: 0,
            dataType: "string",
            allowBlank: !1,
            editable: !1,
            componentType: "下拉扩展控件",
            defaultValue: Snmon.Configs[0],
            store: Snmon.Configs,
            model: "local",
            configType: this.configTypeConfigType
          }]
        })
      }
    },
    Common: {
      PanelFields: ["容器类型", "默认宽度", "标签宽度", "汇总类型", "列数", "分组字段", "控件名称"],
      PackageData: function() {
        var p = Util.getCmp("Panel"),
          d = p.Data[p.boName],
          g = Util.getCmp("Grid"),
          util, con, data;
        return (Ext.each(this.PanelFields, function(property) {
          if (con = Util.getCmp("Panel_" + property), con)
            if (con.isValid()) d[property] = con.getValue();
            else return Msg.Normal('表单的 "' + property + '" 内容有误!'), util = !1, !1
        }), util === !1) ? !1 : (data = Snmon.data.打包列表数据(g, !0), data === !1) ? !1 : (d.控件配置属性信息列表 = data[g.boName], p.Data)
      },
      SetConfig: function(data) {
        var p = Util.getCmp("Panel"),
          d = data[p.boName],
          con;
        p.Data = data, d.默认宽度 || (d.默认宽度 = d.容器类型 == "表单" ? 160 : d.容器类型 == "常用条件" ? 85 : 120), Ext.each(this.PanelFields, function(property) {
          con = Util.getPanelCmp(property), con && con.setValue(d[property])
        }), Util.getPanelCmp("容器类型").getValue() == "常用条件" && Util.getCmp("GridAddRow").hide(), Util.getCmp("Grid").store.loadData(d.控件配置属性信息列表)
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {
          this.Grid.Init(), this.Store.Init()
        },
        Grid: {
          Init: function() {
            var me = this,
              g = Util.getCmp("Grid");
            g.on("select", me.OnGridSelect, me);
            g.on("deselect", me.OnGridDeselect, me);
            g.on("beforeedit", me.OnGridBeforeEdit, me);
            g.on("validateedit", me.OnGridValidateEdit, me)
          },
          OnGridSelect: function() {
            Util.getCmp("GridDelRow").setDisabled(!1)
          },
          OnGridDeselect: function() {
            Util.getCmp("GridDelRow").setDisabled(!0)
          },
          OnGridBeforeEdit: function(editor, e) {
            var field = e.field,
              record = e.record,
              _数据类型 = record.get("数据类型");
            if (field == "数据类型" || field == "可合计" && ["int", "float"].indexOf(_数据类型) == -1) return !1;
            if (field == "来源属性") {
              if (["object", "array"].indexOf(_数据类型) == -1) return !1;
              Snmon.ComponentConfig.Service.GetSourceAttributeByBoName(e.record.get("属性类型名"))
            }
            switch (Util.getCmp("Panel_容器类型").getValue()) {
              case "常用条件":
                if (["字段名", "分组", "配置类型", "编辑类型", "行合并", "列合并", "可合计"].indexOf(field) != -1) return !1;
                break;
              case "表单":
                if (["比较符", "可合计", "区间"].indexOf(field) != -1) return !1;
                break;
              case "列表":
                if (["分组", "比较符", "行合并", "列合并", "区间"].indexOf(field) != -1) return !1
            }
            switch (record.get("控件类型")) {
              case "文本控件":
              case "扩展控件":
              case "扩展控件二":
                if (["高度", "小数位数", "最小值", "最大值", "格式化", "多选", "区间"].indexOf(field) != -1) return !1;
                break;
              case "数值控件":
                if (["高度", "最大字符", "多选"].indexOf(field) != -1) return !1;
                break;
              case "日期控件":
                if (["高度", "小数位数", "最大字符", "多选"].indexOf(field) != -1) return !1;
                break;
              case "复选控件":
                if (["高度", "小数位数", "最大字符", "最小值", "最大值", "格式化", "必填", "多选", "区间"].indexOf(field) != -1) return !1;
                break;
              case "下拉控件":
              case "查询下拉控件":
              case "下拉扩展控件":
              case "枚举下拉控件":
              case "查询控件":
                if (["高度", "小数位数", "最大字符", "最小值", "最大值", "格式化", "区间"].indexOf(field) != -1) return !1;
                break;
              case "显示控件":
                if (["高度", "小数位数", "最大字符", "最小值", "最大值", "格式化", "必填", "多选", "区间"].indexOf(field) != -1) return !1;
                break;
              case "树控件":
              case "商品或设备树控件":
                if (["高度", "小数位数", "最大字符", "最小值", "最大值", "格式化", "多选", "区间"].indexOf(field) != -1) return !1;
                break;
              case "文件上传控件":
                if (["高度", "小数位数", "最大字符", "最小值", "最大值", "默认值", "格式化", "多选", "区间"].indexOf(field) != -1) return !1;
                break;
              case "图片上传控件":
                if (["小数位数", "最大字符", "最小值", "最大值", "默认值", "格式化", "多选", "区间"].indexOf(field) != -1) return !1;
                break;
              case "区域控件":
              case "Python控件":
              case "Html控件":
              case "超文本控件":
                if (["小数位数", "最小值", "最大值", "格式化", "多选", "区间"].indexOf(field) != -1) return !1
            }
            return this.默认值的编辑(editor, e)
          },
          OnGridValidateEdit: function(editor, e) {
            var field = e.field,
              record = e.record,
              value = e.value;
            if (field == "控件类型") switch (record.get("数据类型")) {
              case "string":
                return record.get("属性类型名") == "String" ? ["文本控件", "区域控件", "Python控件", "Html控件", "显示控件", "商品或设备树控件", "超文本控件", "下拉扩展控件", "扩展控件", "扩展控件二", "图片上传控件二", "图片上传控件三", "外部树控件", "外部下拉控件", "外部查询控件"].indexOf(value) != -1 : ["枚举下拉控件"].indexOf(value) != -1;
              case "date":
                return ["时间控件", "日期控件"].indexOf(value) != -1;
              case "array":
              case "object":
                return record.data.控件类型 == "查询下拉控件" && value == "文本控件" ? !0 : ["下拉控件", "查询下拉控件", "查询控件", "树控件", "文件上传控件", "图片上传控件", "下拉扩展控件", "扩展控件"].indexOf(value) != -1
            }
          },
          "默认值的编辑": function(editor, e) {
            if (e.field == "默认值") {
              var record = e.record,
                dtype = record.get("数据类型"),
                field;
              switch (dtype) {
                case "int":
                case "float":
                  field = Snmon.field.Number({
                    hideLabel: !1
                  });
                  break;
                case "object":
                  field = Ext.form.field.Trigger({
                    id: Util.id("Query_" + record.get("字段名").replace(/\./g, "_")),
                    xtype: "triggerfield",
                    trigger1Cls: "x-form-clear-trigger",
                    trigger2Cls: "x-form-elp-trigger",
                    hideLabel: !1,
                    editable: !0,
                    listeners: {
                      triggerclick: function(el, trigger, index) {
                        if (index == 0) el.setValue("");
                        else {
                          el.propertyType = record.get("属性类型名");
                          var config = {
                            id: el.id,
                            boName: record.get("属性类型名"),
                            component: el,
                            multiSelect: dtype == "array",
                            rowdblselect: function() {
                              var selModel = config[Util.id(config.gridId)].selModel,
                                records = selModel.getSelection(),
                                lastRecords = selModel.getLastSelected(),
                                ds = [],
                                d, recordItem, showProperty = record.get("属性类型显示属性") || Config.id,
                                i, ln;
                              if (lastRecords && records.indexOf(lastRecords) == -1 && records.push(lastRecords), records.length == 0) {
                                Msg.Normal("请选择..");
                                return
                              }
                              for (i = 0, ln = records.length; i < ln; i++) recordItem = records[i], d = {}, d[Config.id] = recordItem.get(Config.id), d[showProperty] = recordItem.get(showProperty) || "", ds.push(d);
                              config.multiSelect ? record.set("默认值", Ext.encode(ds).replace(/"/g, "'")) : record.set("默认值", Ext.encode(ds[0]).replace(/"/g, "'")), Util.WindowHideOrClose(config.win, config)
                            },
                            select: function() {
                              config[Util.id(config.gridId)].fireEvent("itemdblclick")
                            }
                          };
                          config.win = Snmon.query.Query(config), Ext.isEmptyObject(config.win.config) && (config.win.config = config), config.win.config[Util.id(config.win.config.gridId)].store.loadPage(1)
                        }
                      }
                    }
                  });
                  break;
                default:
                  field = Snmon.field.Text({
                    hideLabel: !1
                  })
              }
              e.column.setEditor(field)
            }
          }
        },
        Store: {
          Init: function() {
            this.Common = Snmon.ComponentConfig.Common;
            var grid = Util.getCmp("Grid");
            grid.store.on("beforeload", this.OnGridBeforeLoad, this)
          },
          OnGridBeforeLoad: function(store) {
            store.setExtraParams("sql", this.Common.GetCondition())
          }
        }
      },
      Button: {
        OnSaveClick: function() {
          var d = Snmon.ComponentConfig.Common.PackageData();
          d !== !1 && Snmon.ComponentConfig.Service.ConfigSave(d)
        },
        OnFieldClick: function() {
          var search = Util.getTabUrlSearch();
          Snmon.window.TreeWindow({
            id: "TreeField",
            rootText: search.boName,
            url: "WebServices/Common/ConfigHandler.ashx",
            extraParams: {
              sign: "ConfigField",
              page: Util.getPageName()
            },
            beforeload: function(store, options) {
              var node = options.node;
              Ext.apply(options.params, {
                name: node && node.raw && node.raw.name || search.boName,
                boName: search.boName,
                cName: search.cName,
                path: node && node.raw && node.raw.path || "",
                cType: search.cType
              })
            },
            select: function() {
              for (var t = Util.getCmp("Tree_TreeField"), records = t.view.getChecked(), fields = [], i = 0, ln = records.length; i < ln; i++) fields.push(records[i].raw.path);
              Snmon.ComponentConfig.Service.GetConfigOfField(fields), Util.getCmp("TreeWindow_TreeField").hide()
            },
            cancel: function() {
              Util.getCmp("TreeWindow_TreeField").hide()
            }
          })
        }
      }
    },
    Service: {
      ConfigSave: function(data) {
        var me = this,
          mask = new Ext.LoadMask(Ext.getBody(), {
            msg: "保存中,请稍等..."
          });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/Common/ConfigHandler.ashx",
          method: "POST",
          params: {
            sign: "ConfigSave",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("控件配置保存成功!", function() {
              me.GetConfig()
            }) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      GetConfig: function() {
        var mask = new Ext.LoadMask(Ext.getBody(), {
            msg: "加载中,请稍等..."
          }),
          search = Util.getTabUrlSearch();
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/Common/ConfigHandler.ashx",
          method: "GET",
          params: {
            sign: "GetConfig",
            boName: search.boName,
            cName: search.cName,
            cType: search.cType,
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? Snmon.ComponentConfig.Common.SetConfig(Ext.decode(result)) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      GetConfigOfField: function(fields) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
            msg: "加载中,请稍等..."
          }),
          search = Util.getTabUrlSearch();
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/Common/ConfigHandler.ashx",
          method: "POST",
          params: {
            sign: "GetConfigOfField",
            boName: search.boName,
            cName: search.cName,
            cType: search.cType,
            fields: fields.join(";"),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? Util.getCmp("Grid").store.loadData(Ext.decode(result)) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      GetSourceAttributeByBoName: function(boName) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "加载中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/Common/ConfigHandler.ashx",
          method: "POST",
          params: {
            sign: "GetSourceAttributeByBoName",
            boName: boName,
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var obj, _来源属性Cmp, items = [];
            _来源属性Cmp = Util.getCmp("Grid_来源属性"), obj = Ext.decode(r.responseText), Ext.each(obj, function(item) {
              items.push({
                id: item,
                field1: item
              })
            }), _来源属性Cmp.store.loadData(items)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.ComponentConfigList = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var btnEvet = Snmon.ComponentConfigList.Event.Button,
          grid = this.GetGrid();
        Util.AddMainPanel([grid], [{
          xtype: "button",
          id: Util.id("ButtonConfig"),
          text: "配置",
          disabled: !0,
          iconCls: "icon-add",
          handler: btnEvet.OnConfigClick
        }, {
          xtype: "button",
          id: Util.id("ButtonDelete"),
          text: "删除",
          disabled: !0,
          iconCls: "icon-add",
          handler: btnEvet.OnDeleteClick
        }, {
          xtype: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-add",
          handler: Util.PageRefresh
        }])
      },
      GetGrid: function() {
        return Snmon.grid.Grid({
          id: "Grid",
          url: "WebServices/Common/ConfigHandler.ashx",
          extraParams: {
            sign: "PagingFind",
            page: Util.getPageName()
          },
          multiSelect: !0,
          selType: "checkboxmodel",
          pageSize: 15,
          region: "center",
          autoLoad: !0,
          config: !1,
          paging: !0,
          root: "data",
          BoName: "控件配置",
          items: [{
            fieldLabel: "ID",
            dataType: "string"
          }, {
            fieldLabel: "业务名称",
            width: 120,
            dataType: "string"
          }, {
            fieldLabel: "控件名称",
            width: 300,
            dataType: "string"
          }, {
            fieldLabel: "容器类型",
            width: 60,
            dataType: "string"
          }, {
            fieldLabel: "配置类型",
            width: 60,
            dataType: "string"
          }, {
            fieldLabel: "编辑类型",
            width: 120,
            dataType: "string"
          }, {
            fieldLabel: "列数",
            width: 60,
            decimalPrecision: 0,
            dataType: "int"
          }, {
            fieldLabel: "标签宽度",
            width: 60,
            dataType: "int"
          }, {
            fieldLabel: "默认宽度",
            width: 60,
            dataType: "int"
          }]
        })
      }
    },
    Common: {
      GetCondition: function() {
        var _容器 = Util.getCmp("Combobox_容器").getValue(),
          _业务名称 = Util.getCmp("TextField_业务名称").getValue().trim(),
          _控件名称 = Util.getCmp("TextField_控件名称").getValue().trim(),
          query = [];
        return _容器 != "全部" && query.push('容器类型=="' + _容器 + '"'), _业务名称 && query.push('业务名称.Contains("' + _业务名称 + '")'), _控件名称 && query.push('控件名称.Contains("' + _控件名称 + '")'), query.join(" and ")
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {
          Util.OnComponent("clientconfigtoolbar", this.OnGridConfigToolbar, this)
        },
        OnGridConfigToolbar: function(toolbar) {
          toolbar.id == Util.id("GridConfigToolbar") && toolbar.add(0, "容器", {
            id: Util.id("Combobox_容器"),
            xtype: "combobox",
            width: 60,
            triggerAction: "all",
            mode: "local",
            value: "全部",
            store: Snmon.Containers,
            editable: !1
          }, "业务名称", {
            id: Util.id("TextField_业务名称"),
            xtype: "textfield",
            width: 100
          }, "控件名称", {
            id: Util.id("TextField_控件名称"),
            xtype: "textfield",
            width: 100
          }, {
            text: "过滤",
            handler: function() {
              Util.getCmp("Grid").store.loadPage(1)
            }
          })
        }
      },
      AfterEvent: {
        Init: function() {
          this.Grid.Init(), this.Store.Init()
        },
        Grid: {
          Init: function() {
            var me = this,
              g = Util.getCmp("Grid");
            g.on("select", me.OnGridSelect);
            g.on("deselect", me.OnGridSelect)
          },
          OnGridSelect: function(rowModel) {
            var btnConfig = Util.getCmp("ButtonConfig"),
              btnDelete = Util.getCmp("ButtonDelete"),
              count = rowModel.getSelection().length;
            count == 1 ? (btnConfig.setDisabled(!1), btnDelete.setDisabled(!1)) : count > 1 ? (btnConfig.setDisabled(!0), btnDelete.setDisabled(!1)) : (btnConfig.setDisabled(!0), btnDelete.setDisabled(!0))
          }
        },
        Store: {
          Init: function() {
            this.Common = Snmon.ComponentConfigList.Common;
            var s = Util.getCmp("Grid").store;
            s.on("beforeload", this.OnGridBeforeLoad, this)
          },
          OnGridBeforeLoad: function(store) {
            store.setExtraParams("sql", this.Common.GetCondition())
          }
        }
      },
      Button: {
        OnConfigClick: function() {
          var g = Util.getCmp("Grid"),
            record = g.selModel.getLastSelected();
          record && Url.GotoPage(record, "ConfigViews/ComponentConfig.aspx", {
            boName: record.get("业务名称"),
            cName: record.get("控件名称"),
            cType: record.get("容器类型")
          })
        },
        OnDeleteClick: function() {
          Msg.Confirm("确认删除吗?", function(btn) {
            if (btn == "ok") {
              var records = Util.getCmp("Grid").selModel.getSelection(),
                ids = [];
              records.length > 0 && (Ext.each(records, function(item) {
                ids.push(item.get("ID"))
              }), Snmon.ComponentConfigList.Service.Delete(ids.join(",")))
            }
          })
        }
      }
    },
    Service: {
      Delete: function(id) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "删除中..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/Common/ConfigHandler.ashx",
          method: "GET",
          params: {
            sign: "ConfigDelete",
            id: id,
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("控件配置删除成功!", function() {
              Util.getCmp("Grid").store.loadPage(1)
            }) : Msg.Normal(result) : Msg.Question(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Question(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.SAPPurchaseOrderSynch = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render({
        multiSelect: !0,
        autoLoad: !1,
        RemoveButtons: ["Query", "Export"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var btnGridSearch, state;
        btnGridSearch = Util.getCmp("ButtonGridSearch"), delete btnGridSearch.keys.用户号, btnGridSearch.fields.remove("用户号"), delete btnGridSearch.keys.密码, btnGridSearch.fields.remove("密码"), delete btnGridSearch.keys.公司, btnGridSearch.fields.remove("公司"), delete btnGridSearch.keys.供应商, btnGridSearch.fields.remove("供应商"), delete btnGridSearch.keys.采购单号, btnGridSearch.fields.remove("采购单号"), delete btnGridSearch.keys.开始时间, btnGridSearch.fields.remove("开始时间"), delete btnGridSearch.keys.结束时间, btnGridSearch.fields.remove("结束时间"), state = Util.getCmp("ComboBoxState"), state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [];
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          items.push(item.raw)
        }), obj.SAP采购订单同步 = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(2, {
              id: Util.id("修改订单"),
              text: "修改订单",
              iconCls: "icon-save"
            })
          }), Util.OnComponent("clientbeforetextcreate", function(o) {
            o.property == "密码" && (o.inputType = "password")
          })
        }
      },
      After: {
        Init: function() {
          var grid, btn修改订单;
          grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridStoreload, this);
          btn修改订单 = Util.getCmp("修改订单");
          btn修改订单.on("click", this.On修改订单, this)
        },
        OnGridStoreload: function(store) {
          var grid, _用户号Cmp, _密码Cmp, _公司Cmp, _供应商Cmp, _开始时间Cmp, _结束时间Cmp, _采购单号Cmp, _用户号, _密码, _公司, _供应商, _开始时间, _结束时间, _采购单号, data = {},
            btn修改订单;
          _用户号Cmp = Util.getCmp("QueryComplexFormGrid_用户号"), _用户号Cmp && (_用户号 = _用户号Cmp.getValue()), _密码Cmp = Util.getCmp("QueryComplexFormGrid_密码"), _密码Cmp && (_密码 = _密码Cmp.getValue()), _公司Cmp = Util.getCmp("QueryComplexFormGrid_公司"), _公司Cmp && (_公司 = _公司Cmp.getValue()), _供应商Cmp = Util.getCmp("QueryComplexFormGrid_供应商"), _供应商Cmp && (_供应商 = _供应商Cmp.getValue()), _采购单号Cmp = Util.getCmp("QueryComplexFormGrid_采购单号"), _采购单号Cmp && (_采购单号 = _采购单号Cmp.getValue()), _开始时间Cmp = Util.getCmp("QueryComplexFormGrid_开始时间"), _开始时间Cmp && (_开始时间 = _开始时间Cmp.getValue()), _结束时间Cmp = Util.getCmp("QueryComplexFormGrid_结束时间"), _结束时间Cmp && (_结束时间 = _结束时间Cmp.getValue()), (_用户号 && _密码 && _公司 && _采购单号 && _开始时间 && _结束时间) == !1 && Msg.Normal("用户号,密码,公司,采购单号,下达开始时间和下达结束时间不能为空!"), _采购单号 != "" ? (btn修改订单 = Util.getCmp("修改订单"), btn修改订单.show()) : (btn修改订单 = Util.getCmp("修改订单"), btn修改订单.hide()), grid = Util.getCmp("Grid"), data[grid.boName] = {
            "用户号": _用户号,
            "密码": _密码,
            "公司": _公司 || "",
            "采购单号": _采购单号 || "",
            "供应商": _供应商 || "",
            "开始时间": _开始时间,
            "结束时间": _结束时间
          }, store.setExtraParams("filterObjectData", Ext.encode(data))
        },
        "On转入电商平台": function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.SAPPurchaseOrderSynch.Common.PackData(), data !== !1) && Msg.Confirm("确定转入吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/SAPPurchaseOrderSynchHandler.ashx",
              params: {
                sign: "_转入电商平台",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Msg.Normal("转入完成!", function() {
                  Util.getCmp("Grid").store.loadPage(1)
                }) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        "On修改订单": function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.SAPPurchaseOrderSynch.Common.PackData(), data !== !1) && Msg.Confirm("确定修改吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/SAPPurchaseOrderSynchHandler.ashx",
              params: {
                sign: "_修改订单",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Msg.Normal("修改完成!", function() {
                  Util.getCmp("Grid").store.loadPage(1)
                }) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        }
      }
    }
  }
}(),
function() {
  Snmon.fhQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var btnGridSearch, state;
        btnGridSearch = Util.getCmp("ButtonGridSearch"), state = Util.getCmp("ComboBoxState"), state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data, flag = !1;
        return (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          if (data = item.raw, data.发货数量 = item.data.发货数量, data.数量 = item.data.数量, data.供应商最后发货数量 = item.data.供应商最后发货数量, data.发货数量 == 0 || data.发货数量 > data.订单未清数量) return flag = !0, !1;
          data.变更 = item.data.变更, items.push(data)
        }), flag) ? (Msg.Normal("发货数量等于零或大于未清数量,请检查选中的记录!"), !1) : (obj.采购订单 = items, obj)
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("批量补发"),
              text: "批量补发",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("批量补发");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this);
          grid.store.on("load", this.OnGridStoreLoad, this)
        },
        OnSave: function() {
          var grid, records, data, mask;
          if (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), records.length == 0) {
            Msg.Normal("请选择记录!");
            return
          }(data = Snmon.fhQuery.Common.PackData(), data !== !1) && Msg.Confirm("确定补发吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
              params: {
                sign: "PurchaseOrderDelivery",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = Ext.decode(r.responseText);
                result.success ? (open("/Prints/Views/cgshd.htm?id=" + Snmon.USERID2 + "&cid=" + result.ids), Util.getCmp("Grid").store.loadPage(1)) : Msg.Normal(result.msg), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridBeforeEdit: function(editor, e) {
          if (e.field != "发货数量") return !1
        },
        OnGridStoreLoad: function(store, records) {
          Ext.each(records, function(item) {
            item.set("发货数量", item.get("订单未清数量")), item.set("变更", !0)
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.gysqrQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History", "Open", "Close"],
        items: "",
        ShowQuery: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data;
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          data = item.raw, items.push(data)
        }), obj.采购检验单来源 = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("退货签收"),
              text: "退货签收",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("退货签收");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.gysqrQuery.Common.PackData(), data !== !1) && Msg.Confirm("确定签收吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseCheckoutHandler.ashx",
              params: {
                sign: "SavegysqrQuery",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.thcgqrQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History", "Open", "Close"],
        items: "",
        ShowQuery: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data;
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          data = item.raw, data.是否通知供应商 = item.get("是否通知供应商"), items.push(data)
        }), obj.采购检验单来源 = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("退货确认"),
              text: "退货确认",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("退货确认");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.thcgqrQuery.Common.PackData(), data !== !1) && Msg.Confirm("确定退货吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseCheckoutHandler.ashx",
              params: {
                sign: "SavethcgqrQuery",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridBeforeEdit: function(editor, e) {
          if (["是否补发"].indexOf(e.field) == -1) return !1
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.thckqrQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History", "Open", "Close"],
        items: "",
        ShowQuery: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data;
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          data = item.raw, items.push(data)
        }), obj.采购检验单来源 = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("退货确认"),
              text: "退货确认",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("退货确认");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.thckqrQuery.Common.PackData(), data !== !1) && Msg.Confirm("确定退货吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseCheckoutHandler.ashx",
              params: {
                sign: "SavethckqrQuery",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.OEMPurchaseExecutiveList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.OEMPurchaseSetList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: " ",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Event.After.Init()
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.ColourPurchaseOrderList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        Util.getCmp("Grid").view.getRowClass = function(record) {
          return record.raw.颜色 == "黄" ? "grid-row-yellow-style" : record.raw.颜色 == "红" ? "grid-row-red-style" : "grid-row-green-style"
        }
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.CounterConfirm = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [];
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          items.push(item.raw)
        }), obj.采购订单 = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("ButtonSave"),
              text: "批量确认",
              iconCls: "icon-save"
            })
          }), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(5, {
              id: Util.id("Buttontest"),
              text: "短信测试",
              iconCls: "icon-save"
            })
          })
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("ButtonSave");
          btnSave.on("click", this.OnSave, this);
          btnSave = Util.getCmp("Buttontest");
          btnSave.on("click", this.OnTest, this);
          grid = Util.getCmp("Grid");
          grid.on("select", this.OnGridSelect, this);
          grid.on("deselect", this.OnGridSelect, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          Msg.Confirm("确定确认吗?", function(val) {
            if (val == "ok") {
              var data, mask;
              data = Snmon.PurchaseOrderConfirm.Common.PackData(), mask = new Ext.LoadMask(Ext.getBody(), {
                msg: "处理中,请稍等..."
              }), mask.show(), Ext.Ajax.request({
                timeout: Config.timeout,
                method: "POST",
                url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
                params: {
                  sign: "CounterConfirm",
                  data: Ext.encode(data)
                },
                success: function(r) {
                  var result = r.responseText;
                  result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
                },
                failure: function(r) {
                  mask.hide(), Msg.Failure(r.responseText)
                }
              })
            }
          })
        },
        OnTest: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          Msg.Confirm("确认发送测试短信?", function(val) {
            if (val == "ok") {
              var data, mask;
              data = Snmon.PurchaseOrderConfirm.Common.PackData(), mask = new Ext.LoadMask(Ext.getBody(), {
                msg: "处理中,请稍等..."
              }), mask.show(), Ext.Ajax.request({
                timeout: Config.timeout,
                method: "POST",
                url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
                params: {
                  sign: "test",
                  data: Ext.encode(data)
                },
                success: function(r) {
                  var result = r.responseText;
                  result == "OK" ? Msg.Normal("发送成功") : Msg.Normal(result), mask.hide()
                },
                failure: function(r) {
                  mask.hide(), Msg.Failure(r.responseText)
                }
              })
            }
          })
        },
        OnGridSelect: function() {
          var btnSave, records, flag = !1;
          return btnSave = Util.getCmp("ButtonSave"), records = Util.getCmp("Grid").selModel.getSelection(), btnSave.setDisabled(!1), Ext.each(records, function(item) {
            if (item.raw.打开关闭状态ID == "bf2d511a-cf72-49ee-9f37-2123577d3864") return flag = !0, !1
          }), flag == !0 ? (btnSave.setDisabled(!0), !1) : void 0
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        },
        OnButtonGridSearchBeforeQuery: function() {}
      }
    }
  }
}(),
function() {
  Snmon.CounterConfirmCopy = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        Util.getCmp("ComboBoxState").hide();
        var toolbar;
        toolbar = Util.getCmp("Toolbar"), toolbar.insert(0, {
          id: Util.id("ButtonSave"),
          text: "批量确认",
          iconCls: "icon-save"
        })
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [];
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          items.push(item.raw)
        }), obj.采购订单 = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("ButtonSave");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.on("select", this.OnGridSelect, this);
          grid.on("deselect", this.OnGridSelect, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          Msg.Confirm("确定确认吗?", function(val) {
            if (val == "ok") {
              var data, mask;
              data = Snmon.PurchaseOrderConfirm.Common.PackData(), mask = new Ext.LoadMask(Ext.getBody(), {
                msg: "处理中,请稍等..."
              }), mask.show(), Ext.Ajax.request({
                timeout: Config.timeout,
                method: "POST",
                url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
                params: {
                  sign: "CounterConfirm",
                  data: Ext.encode(data)
                },
                success: function(r) {
                  var result = r.responseText;
                  result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
                },
                failure: function(r) {
                  mask.hide(), Msg.Failure(r.responseText)
                }
              })
            }
          })
        },
        OnGridSelect: function() {
          var btnSave, records, flag = !1;
          return btnSave = Util.getCmp("ButtonSave"), records = Util.getCmp("Grid").selModel.getSelection(), btnSave.setDisabled(!1), Ext.each(records, function(item) {
            if (item.raw.打开关闭状态ID == "bf2d511a-cf72-49ee-9f37-2123577d3864") return flag = !0, !1
          }), flag == !0 ? (btnSave.setDisabled(!0), !1) : void 0
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        },
        OnButtonGridSearchBeforeQuery: function() {}
      }
    }
  }
}(),
function() {
  Snmon.CounterConfirmQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "View", "Query", "History", "Delete"],
        items: "",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.InvoiceQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Common: {},
    Render: {
      Init: function() {
        var toolbar, state;
        toolbar = Util.getCmp("Toolbar"), toolbar.insert(0, {
          id: Util.id("ButtonPrint"),
          text: "打印",
          disabled: !0,
          iconCls: "icon-print"
        }), toolbar.insert(1, {
          id: Util.id("ButtonSave"),
          text: "修改发货数",
          disabled: !0,
          iconCls: "icon-save"
        }), state = Util.getCmp("ComboBoxState"), state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", function(config) {
            config.id == "Grid" && (config.canEditor = !0)
          })
        }
      },
      After: {
        Init: function() {
          var btnPrint, grid;
          btnPrint = Util.getCmp("ButtonPrint"), btnPrint && btnPrint.on("click", this.OnPrint, this), btnSave = Util.getCmp("ButtonSave"), btnSave && btnSave.on("click", this.OnSave, this), grid = Util.getCmp("Grid");
          grid.on("select", this.OnGridSelect, this);
          grid.on("deselect", this.OnGridSelect, this)
        },
        OnPrint: function() {
          var grid, record, items = [];
          grid = Util.getCmp("Grid"), record = grid.selModel.getSelection(), Ext.each(record, function(item) {
            items.push(item.get("ID"))
          }), record && open("/Prints/Views/cgshd.htm?id=" + Snmon.USERID2 + "&ids=" + items)
        },
        OnGridSelect: function(rowModel, record) {
          var btnPrint, btnSave, grid, record;
          btnPrint = Util.getCmp("ButtonPrint"), btnSave = Util.getCmp("ButtonSave"), grid = Util.getCmp("Grid"), record = grid.selModel.getSelection(), rowModel.getSelection().length == 0 ? btnPrint && btnPrint.disable() : btnPrint && btnPrint.enable(), rowModel.getSelection().length != 1 || record[0].raw.仓库收货确认员ID ? btnSave && btnSave.disable() : btnSave && btnSave.enable()
        },
        OnSave: function() {
          var win, grid, records, ok, oks;
          if (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), ok = records.length != 1 ? !1 : records[0].raw, records.length != 1 || ok.仓库收货确认员ID) Msg.Normal("只能选择一条记录且处于全部发货状态!");
          else {
            win = Util.getCmp("WindowNumber"), win || (win = Ext.create("Ext.window.Window", {
              id: Util.id("WindowNumber"),
              title: "修改发货数量",
              width: 160,
              constrainHeader: !0,
              closable: !1,
              resizable: !1,
              modal: Config.modal,
              items: [{
                xtype: "numberfield",
                id: Util.id("Number")
              }],
              bbar: ["->", {
                text: "确认",
                iconCls: "icon-accept",
                handler: function() {
                  var con = Util.getCmp("Number").getValue();
                  Ext.Ajax.request({
                    timeout: Config.timeout,
                    method: "POST",
                    url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
                    params: {
                      sign: "DetermineDelivery",
                      id: ok.ID
                    },
                    success: function(r) {
                      var result = r.responseText,
                        data;
                      if (result == 0) Msg.Normal("采购订单来源在系统中不存在，请确认发货单信息是否正确");
                      else {
                        if (oks = result, con <= 0 || con > oks) {
                          Msg.Normal("发货数量异常!");
                          return
                        }
                        data = records[0].raw, mask = new Ext.LoadMask(Ext.getBody(), {
                          msg: "处理中,请稍等..."
                        }), mask.show(), Ext.Ajax.request({
                          timeout: Config.timeout,
                          method: "POST",
                          url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
                          params: {
                            sign: "ModifyDelivery",
                            number: con,
                            id: data.ID
                          },
                          success: function(r) {
                            var result = r.responseText;
                            result == "OK" ? (Msg.Normal("修改成功!"), Util.getCmp("Grid").store.loadPage(1)) : Msg.Normal(result), mask.hide()
                          }
                        })
                      }
                    }
                  }), Util.getCmp("Number").setValue(""), Util.WindowHideOrClose(win)
                }
              }, {
                text: "取消",
                iconCls: "icon-close",
                handler: function() {
                  Util.getCmp("Number").setValue(""), Util.WindowHideOrClose(win)
                }
              }]
            })), win.show();
            return
          }
        }
      }
    }
  }
}(),
function() {
  Snmon.OrderManagementList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("处理物料大类"),
              text: "处理物料大类",
              iconCls: "icon-save"
            }), toolbar.insert(1, {
              id: Util.id("处理供应商"),
              text: "处理供应商",
              iconCls: "icon-save"
            }), toolbar.insert(2, {
              id: Util.id("处理公司"),
              text: "处理公司",
              iconCls: "icon-save"
            }), toolbar.insert(3, {
              id: Util.id("删除"),
              text: "删除",
              iconCls: "icon-delete"
            })
          })
        }
      },
      After: {
        Init: function() {
          var btnSave, btnSaveGYS, btnSaveGS, btnDel, grid;
          btnSave = Util.getCmp("处理物料大类"), btnSaveGYS = Util.getCmp("处理供应商"), btnSaveGS = Util.getCmp("处理公司"), btnDel = Util.getCmp("删除");
          btnSave.on("click", this.OnSave, this);
          btnSaveGYS.on("click", this.OnSaveGYS, this);
          btnSaveGS.on("click", this.OnSaveGS, this);
          btnDel.on("click", this.OnDeleteGS, this);
          grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this);
          grid.store.on("load", function() {})
        },
        OnSave: function() {
          Msg.Confirm("确定转换吗?", function(val) {
            if (val == "ok") {
              var mask;
              mask = new Ext.LoadMask(Ext.getBody(), {
                msg: "处理中,请稍等..."
              }), mask.show(), Ext.Ajax.request({
                timeout: Config.timeout,
                method: "POST",
                url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
                params: {
                  sign: "OrderManagement"
                },
                success: function(r) {
                  var result = r.responseText;
                  result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
                },
                failure: function(r) {
                  mask.hide(), Msg.Failure(r.responseText)
                }
              })
            }
          })
        },
        OnSaveGYS: function() {
          Msg.Confirm("确定转换吗?", function(val) {
            if (val == "ok") {
              var mask;
              mask = new Ext.LoadMask(Ext.getBody(), {
                msg: "处理中,请稍等..."
              }), mask.show(), Ext.Ajax.request({
                timeout: Config.timeout,
                method: "POST",
                url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
                params: {
                  sign: "OrderManagementGYS"
                },
                success: function(r) {
                  var result = r.responseText;
                  result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
                },
                failure: function(r) {
                  mask.hide(), Msg.Failure(r.responseText)
                }
              })
            }
          })
        },
        OnSaveGS: function() {
          Msg.Confirm("确定转换吗?", function(val) {
            if (val == "ok") {
              var mask;
              mask = new Ext.LoadMask(Ext.getBody(), {
                msg: "处理中,请稍等..."
              }), mask.show(), Ext.Ajax.request({
                timeout: Config.timeout,
                method: "POST",
                url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
                params: {
                  sign: "OrderManagementGS"
                },
                success: function(r) {
                  var result = r.responseText;
                  result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
                },
                failure: function(r) {
                  mask.hide(), Msg.Failure(r.responseText)
                }
              })
            }
          })
        },
        OnDeleteGS: function() {
          Msg.Confirm("确认删除吗?", function(btn) {
            var i, j;
            if (btn == "ok") {
              var pageInfo = Util.GetSnmonPage().pageInfo,
                g = Util.getCmp("Grid"),
                boName = pageInfo.HeadBoName || pageInfo.GridBoName,
                records = g.selModel.getSelection(),
                invoices = [],
                raw, headId, exist, d = {};
              for (i = records.length - 1; i >= 0; i--)
                if (raw = records[i].raw, headId = raw[Config.headId], headId) {
                  for (exist = !1, j = invoices.length - 1; j >= 0; j--)
                    if (invoices[j].ID === headId) {
                      exist = !0;
                      break
                    }
                  if (exist) continue;
                  invoices.push({
                    ID: headId
                  })
                } else invoices.push({
                  ID: raw[Config.id]
                });
              d[boName] = invoices, Snmon.service.SaveData({
                data: d,
                boName: boName,
                expParam: "",
                method: "删除",
                msg: "正在删除,请稍等...",
                okMsg: "删除成功!",
                isList: !0,
                handler: function() {
                  g.store.loadPage(1)
                }
              })
            }
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.ProcurementNotCompleteList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseCheckout = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "Open", "Close", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data;
        return (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          data = item.raw, data.检验数量 = item.get("检验数量"), data.抽样数量 = item.get("抽样数量"), data.检验合格数量 = item.get("检验合格数量"), data.检验不合格数量 = item.get("检验不合格数量"), data.判定合格数量 = item.get("判定合格数量"), data.判定不合格数量 = item.get("判定不合格数量"), items.push(data)
        }), !1) ? (Msg.Normal("检验数量不能为0,请检查选中的记录!"), !1) : (obj.采购发货单 = items, obj)
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clientincolumncreate", this.OnColumnCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("批量检验"),
              text: "批量检验",
              iconCls: "icon-save"
            })
          })
        },
        OnColumnCreate: function(config, item) {
          item.property == "检验" && (item.renderer = function(value, metaData, record) {
            return '<a href="javascript:void(0)" onclick="Snmon.PurchaseCheckout.Event.OnCheckout(\'' + record.get("ID") + "')\">检验<\/a>"
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("批量检验");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.on("validateedit", this.OnGridValidateEdit, this);
          grid.on("edit", this.OnGridEdit, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this);
          grid.store.on("load", this.OnGridStoreLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.PurchaseCheckout.Common.PackData(), data !== !1) && Msg.Confirm("确定检验吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseInvoiceHandler.ashx",
              params: {
                sign: "SavePurchaseCheckout",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridBeforeEdit: function(editor, e) {
          if (["检验合格数量", "检验不合格数量"].indexOf(e.field) == -1) return !1
        },
        OnGridValidateEdit: function(editor, e) {
          var record = e.record;
          switch (e.field) {
            case "检验数量":
              if (Number.FloatSubt(record.get("收货数量"), record.get("最后检验数量")) < e.value) return !1;
              break;
            case "检验合格数量":
              if (record.get("检验数量") < e.value) return !1;
              break;
            case "检验不合格数量":
              if (record.get("检验数量") < e.value) return !1
          }
        },
        OnGridEdit: function(editor, e) {
          var record, _不合格数量, _合格数量;
          record = e.record;
          switch (e.field) {
            case "检验数量":
              record.set("抽样数量", e.value), record.set("检验合格数量", e.value), record.set("检验不合格数量", 0), record.set("判定合格数量", e.value), record.set("判定不合格数量", 0);
              break;
            case "检验合格数量":
              _不合格数量 = Number.FloatSubt(record.get("检验数量"), e.value), record.set("检验不合格数量", _不合格数量), record.set("判定合格数量", e.value), record.set("判定不合格数量", _不合格数量);
              break;
            case "检验不合格数量":
              _合格数量 = Number.FloatSubt(record.get("检验数量"), e.value), record.set("检验合格数量", _合格数量), record.set("判定不合格数量", e.value), record.set("判定合格数量", _合格数量)
          }
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        },
        OnGridStoreLoad: function(store, records) {
          Ext.each(records, function(item) {
            var _剩余数量 = Number.FloatSubt(item.get("收货数量"), 0);
            item.set("检验数量", _剩余数量), item.set("抽样数量", _剩余数量), item.set("检验合格数量", _剩余数量), item.set("判定合格数量", _剩余数量)
          })
        }
      },
      OnCheckout: function(purchaseInvoiceId) {
        Url.GotoEditPage(this, "OperationViews/Purchase/PurchaseCheckoutEdit.aspx", "采购检验单", 1, "", {
          PurchaseInvoiceId: purchaseInvoiceId
        })
      }
    }
  }
}(),
function() {
  Snmon.PurchaseCheckoutEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clientbeforeload", this.OnBeforeLoad, this)
        },
        OnBeforeGridCreate: function() {},
        OnBeforeLoad: function() {
          if (Snmon.PurchaseCheckoutEdit.UrlQuery == "") {
            var search = Util.getTabUrlSearch();
            Snmon.PurchaseCheckoutEdit.UrlQuery = "PurchaseInvoiceId=" + search.PurchaseInvoiceId
          }
        }
      },
      After: {
        Init: function() {
          var _检验依据Cmp, _产品类别Cmp, panel, grid = Util.getCmp("GridDetail");
          grid.on("edit", this.OnGridEditorEdit, this);
          if (_检验依据Cmp = Util.getPCmp("检验依据"), _检验依据Cmp) {
            _检验依据Cmp.on("clientbeforeshow", this.On检验依据BeforeShow, this);
            _检验依据Cmp.on("clientvalue", this.On检验依据Value, this);
            _检验依据Cmp.on("clientquerybeforeload", this.On检验依据QueryBeforeLoad, this)
          }
          if (_产品类别Cmp = Util.getPCmp("产品类别"), _产品类别Cmp) {
            _产品类别Cmp.on("clientclear", this.On产品类别Change, this);
            _产品类别Cmp.on("clientvalue", this.On产品类别Change, this)
          }
          panel = Util.getCmp("Panel");
          panel.on("clientload", this.OnLoad, this)
        },
        OnGridEditorEdit: function(editor, e) {
          var field, record, _检验数量, _检验合格数量, _检验不合格数量;
          if (field = e.field, record = e.record, _检验数量 = record.get("检验数量"), _检验合格数量 = record.get("检验合格数量"), _检验合格数量 > _检验数量) {
            record.set("检验合格数量", _检验数量);
            return
          }
          _检验不合格数量 = Number.FloatSubt(_检验数量, _检验合格数量), record.set("检验不合格数量", _检验不合格数量)
        },
        "On检验依据BeforeShow": function() {},
        "On检验依据Value": function(el, records) {
          var data, _产品类别Cmp;
          data = records[0], _产品类别Cmp = Util.getPCmp("产品类别"), _产品类别Cmp && (_产品类别Cmp.clientdata = data.raw.物料大类, _产品类别Cmp.setValue(_产品类别Cmp.clientdata[_产品类别Cmp.showName])), Snmon.PurchaseCheckoutEdit.Service.GetInspectionBasisById(data.get("ID"))
        },
        "On检验依据QueryBeforeLoad": function(store) {
          var _产品类别Cmp, sql, _产品类别ID;
          _产品类别Cmp = Util.getPCmp("产品类别"), sql = store.getExtraParams("sql"), _产品类别Cmp && _产品类别Cmp.clientdata && (_产品类别ID = _产品类别Cmp.clientdata.ID), _产品类别ID && (sql && (sql += " and "), sql += "物料大类ID='" + _产品类别ID + "'"), store.setExtraParams("sql", sql)
        },
        "On产品类别Change": function() {
          var _检验依据Cmp;
          _检验依据Cmp = Util.getPCmp("检验依据"), _检验依据Cmp && (delete _检验依据Cmp.clientdata, _检验依据Cmp.setValue(""))
        },
        OnLoad: function() {
          var panel;
          panel = Util.getCmp("Panel"), panel.Data[panel.boName].采购发货单ID = Util.getTabUrlSearch().PurchaseInvoiceId
        }
      }
    },
    Service: {
      GetInspectionBasisById: function() {}
    }
  }
}(),
function() {
  Snmon.PurchaseCheckoutList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "OperationViews/Purchase/PurchaseCheckoutEdit.aspx",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseCheckoutQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete"],
        items: "",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseCheckoutsourceList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseConfirmation = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data;
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          data = item.raw, items.push(data)
        }), obj.采购发货单 = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("批量确认"),
              text: "批量确认",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("批量确认");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          Msg.Confirm("确定确认吗?", function(val) {
            if (val == "ok") {
              var data, mask;
              data = Snmon.PurchaseConfirmation.Common.PackData(), mask = new Ext.LoadMask(Ext.getBody(), {
                msg: "处理中,请稍等..."
              }), mask.show(), Ext.Ajax.request({
                timeout: Config.timeout,
                method: "POST",
                url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseInvoiceHandler.ashx",
                params: {
                  sign: "PurchaseConfirmation",
                  data: Ext.encode(data)
                },
                success: function(r) {
                  var result = r.responseText;
                  result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
                },
                failure: function(r) {
                  mask.hide(), Msg.Failure(r.responseText)
                }
              })
            }
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseConfirmationQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete"],
        items: "",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseInvoiceEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.PurchaseInvoiceList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseOrderConfirm = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [];
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          items.push(item.raw)
        }), obj.采购订单 = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("批量确认"),
              text: "批量确认",
              iconCls: "icon-save"
            })
          }), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(1, {
              id: Util.id("打印全部"),
              text: "打印全部",
              iconCls: "icon-save"
            })
          })
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("批量确认");
          btnSave.on("click", this.OnSave, this);
          btnSave = Util.getCmp("打印全部");
          btnSave.on("click", this.On打印全部, this);
          grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        "On打印全部": function() {
          var _采购单号Cmp = Util.getCmp("QueryComplexFormGrid_采购单号"),
            _供应商编号Cmp = Util.getCmp("QueryComplexFormGrid_供应商编号"),
            _公司Cmp = Util.getCmp("QueryComplexFormGrid_公司"),
            _订单日期开始Cmp = Util.getCmp("QueryComplexFormGrid_订单日期"),
            _订单日期结束Cmp = Util.getCmp("QueryComplexFormGrid_订单日期_Region"),
            start = _订单日期开始Cmp.rawValue,
            end = _订单日期结束Cmp.rawValue,
            company = _公司Cmp.rawValue,
            order = _采购单号Cmp.rawValue,
            supplier = _供应商编号Cmp.rawValue;
          open("/Prints/Views/cgdd.htm?id=" + Snmon.USERID2 + "&start=" + start + "&end=" + end + "&company=" + company + "&order=" + order + "&supplier=" + supplier)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          Msg.Confirm("确定确认吗?", function(val) {
            if (val == "ok") {
              var data, mask;
              data = Snmon.PurchaseOrderConfirm.Common.PackData(), mask = new Ext.LoadMask(Ext.getBody(), {
                msg: "处理中,请稍等..."
              }), mask.show(), Ext.Ajax.request({
                timeout: Config.timeout,
                method: "POST",
                url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
                params: {
                  sign: "PurchaseOrderConfirm",
                  data: Ext.encode(data)
                },
                success: function(r) {
                  var result = r.responseText;
                  result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
                },
                failure: function(r) {
                  mask.hide(), Msg.Failure(r.responseText)
                }
              })
            }
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseOrderDelivery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var btnGridSearch, state;
        btnGridSearch = Util.getCmp("ButtonGridSearch"), delete btnGridSearch.keys.是否补发, btnGridSearch.fields.remove("是否补发"), state = Util.getCmp("ComboBoxState"), state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data, flag = !1;
        return (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          if (data = item.raw, data.发货数量 = item.data.发货数量, data.数量 = item.data.数量, data.供应商最后发货数量 = item.data.供应商最后发货数量, data.发货数量 == 0 || data.发货数量 > data.订单未清数量) return flag = !0, !1;
          data.变更 = item.data.变更, items.push(data)
        }), flag) ? (Msg.Normal("发货数量等于零或大于未清数量,请检查选中的记录!"), !1) : (obj.采购订单 = items, obj)
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("批量送货"),
              text: "批量送货",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("批量送货");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this);
          grid.store.on("load", this.OnGridStoreLoad, this)
        },
        OnSave: function() {
          var grid, records, data, mask;
          if (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), records.length == 0) {
            Msg.Normal("请选择记录!");
            return
          }(data = Snmon.PurchaseOrderDelivery.Common.PackData(), data !== !1) && Msg.Confirm("确定送货吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseOrderHandler.ashx",
              params: {
                sign: "PurchaseOrderDelivery",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = Ext.decode(r.responseText);
                result.success ? (open("/Prints/Views/cgshd.htm?id=" + Snmon.USERID2 + "&cid=" + result.ids), Util.getCmp("Grid").store.loadPage(1)) : Msg.Normal(result.msg), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridBeforeEdit: function(editor, e) {
          if (e.field != "发货数量") return !1
        },
        OnGridStoreLoad: function(store, records) {
          Ext.each(records, function(item) {
            item.set("发货数量", item.get("订单未清数量")), item.set("变更", !0)
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseOrderEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.PurchaseOrderList = {
    Load: function() {
      if (this.UrlQuery && (this.UrlQueryBackup = Ext.urlDecode(this.UrlQuery)), this.Event.Before.Init(), ListPage.Render({
          items: "",
          ShowQuery: !1,
          autoLoad: !1,
          RemoveButtons: ["Add", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
        }), this.Render.Init(), this.Event.After.Init(), this.UrlQueryBackup) {
        var _采购单号Cmp, _项目Cmp, btnSearch;
        _采购单号Cmp = Util.getCmp("QueryComplexFormGrid_采购单号"), _采购单号Cmp && _采购单号Cmp.setValue(this.UrlQueryBackup.PurchaseNo), _项目Cmp = Util.getCmp("QueryComplexFormGrid_项目"), _项目Cmp && _项目Cmp.setValue(this.UrlQueryBackup.Item), btnSearch = Util.getCmp("ButtonGridSearch"), btnSearch.fireEvent("click", btnSearch)
      }
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforecomboboxexpandcreate", this.BeforeComboboxExpandCreate, this)
        },
        BeforeComboboxExpandCreate: function(o) {
          o.property == "公司" && (o.store = ["", "1000", "1100", "1200", "1900"], o.value = "")
        }
      },
      After: {
        Init: function() {
          var grid, records;
          grid = Util.getCmp("Grid"), records = grid.selModel.getSelection()
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseOrderQualified = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !1,
        RemoveButtons: ["Add", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforecomboboxexpandcreate", this.BeforeComboboxExpandCreate, this)
        },
        BeforeComboboxExpandCreate: function(o) {
          o.property == "公司名称" && (o.store = ["", "1000", "1100", "1200", "1900"], o.value = "")
        }
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseOrderStorage = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History", "Open", "Close"],
        items: "",
        ShowQuery: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data, ok = !1,
          oks = !1,
          bh, cfs;
        return (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), cfs = "", Ext.each(records, function(item) {
          if (data = item.raw, data.入库数量 = item.get("入库数量"), bh = item.data.供应商.ID, cfs) {
            if (cfs != bh) return oks = !0, !1
          } else cfs = bh;
          if (data.入库凭证号 = item.data.入库凭证号, data.检验合格数量 = item.data.检验合格数量, data.最后入库数量 = item.data.最后入库数量, data.入库数量 > data.检验合格数量 - data.最后入库数量) return ok = !0, !1;
          items.push(data)
        }), ok) ? (Msg.Normal("入库数量异常,请检查选中的记录!"), !1) : oks ? (Msg.Normal("必须是同一个供应商!"), !1) : (obj.采购检验单来源 = items, obj)
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("批量入库"),
              text: "批量入库",
              iconCls: "icon-save"
            }), toolbar.insert(1, {
              id: Util.id("手工入库"),
              text: "手工入库",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid, btnSave3;
          btnSave = Util.getCmp("批量入库");
          btnSave.on("click", this.OnSave, this);
          btnSave3 = Util.getCmp("手工入库");
          btnSave3.on("click", this.OnSave3, this);
          grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this);
          grid.store.on("load", this.OnGridStoreLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.PurchaseOrderStorage.Common.PackData(), data !== !1) && Msg.Confirm("确定入库吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseCheckoutHandler.ashx",
              params: {
                sign: "SavePurchaseReceipt",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = Ext.decode(r.responseText);
                result.success ? (open("/Prints/Views/cgrkd.htm?id=" + Snmon.USERID2 + "&cid=" + result.ids), Util.getCmp("Grid").store.loadPage(1)) : Msg.Normal(result.msg), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnSave3: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var mask, data;
          (data = Snmon.PurchaseOrderStorage.Common.PackData(), data !== !1) && Msg.Confirm("确定入库吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseCheckoutHandler.ashx",
              params: {
                sign: "ManualStorage",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = Ext.decode(r.responseText);
                result.success ? (open("/Prints/Views/cgrkd.htm?id=" + Snmon.USERID2 + "&cid=" + result.ids), Util.getCmp("Grid").store.loadPage(1)) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridBeforeEdit: function(editor, e) {
          if (["入库数量", "入库凭证号"].indexOf(e.field) == -1) return !1
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        },
        OnGridStoreLoad: function(store, records) {
          Ext.each(records, function(item) {
            item.set("入库数量", Number.FloatSubt(item.get("检验合格数量"), item.get("最后入库数量")))
          })
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseReceiptEdit = {
    Load: function() {
      this.Event.Before.Init(), EditPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.PurchaseReceiptInvoiceList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          flag = !1;
        return (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          var data = item.data;
          if (data.凭证抬头文本 = item.get("凭证抬头文本"), data.参考凭证编号 = item.get("参考凭证编号"), data.凭证抬头文本 == "" || data.参考凭证编号 == "") return flag = !0, !1;
          Ext.applyIf(data, item.raw), items.push(data)
        }), flag) ? (Msg.Normal("凭证抬头文本、参考凭证编号不能为空"), !1) : (obj.采购入库单 = items, obj)
      }
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("开发票"),
              text: "开发票",
              iconCls: "icon-add"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var grid;
          btnBomZS = Util.getCmp("开发票"), btnBomZS && btnBomZS.on("click", this.OnCreateFP, this), grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnGridBeforeEdit: function(editor, e) {
          if (["开票金额"].indexOf(e.field) == -1 && e.field != "参考凭证编号" && e.field != "凭证抬头文本") return !1
        },
        OnCreateFP: function() {
          var grid, records, mask, data;
          if (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), records.length != 0) {
            if (data = Snmon.PurchaseReceiptInvoiceList.Common.PackData(), data === !1) return;
            mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/SAPPurchaseOrderSynchHandler.ashx",
              params: {
                sign: "StorageKaiZhang",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result.msg != "" ? (Msg.Normal(result), Util.getCmp("Grid").store.loadPage(1)) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            })
          } else {
            Msg.Normal("请选择记录!");
            return
          }
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        },
        OnGridStoreLoad: function(store, records) {
          Ext.each(records, function(item) {
            item.set("开票金额", Number.FloatMult(item.get("采购订单").单价, item.get("入库数量")))
          })
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseReceiptInvoiceNotSynchronized = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Common: {},
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("处理未同步"),
              text: "处理未同步",
              iconCls: "icon-add"
            })
          })
        }
      },
      After: {
        Init: function() {
          var btnSaveWT;
          btnSaveWT = Util.getCmp("处理未同步"), btnSaveWT && btnSaveWT.on("click", this.OnSaveWTB, this), grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnSaveWTB: function() {
          Msg.Confirm("确定同步吗?", function(val) {
            if (val == "ok") {
              var mask;
              mask = new Ext.LoadMask(Ext.getBody(), {
                msg: "处理中,请稍等..."
              }), mask.show(), Ext.Ajax.request({
                timeout: Config.timeout,
                method: "POST",
                url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseCheckoutHandler.ashx",
                params: {
                  sign: "SynchronizationOrderInvoice"
                },
                success: function(r) {
                  var result = r.responseText;
                  result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
                },
                failure: function(r) {
                  mask.hide(), Msg.Failure(r.responseText)
                }
              })
            }
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseReceiptList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Common: {},
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseReceiptNotSynchronized = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"]
      }), this.Render.Init(), this.Event.After.Init()
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data;
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          data = item.data, Ext.applyIf(data, item.raw), items.push(data)
        }), obj.采购入库单 = items, obj
      }
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("处理未同步"),
              text: "处理未同步",
              iconCls: "icon-add"
            })
          })
        }
      },
      After: {
        Init: function() {
          var btnSaveWT;
          btnSaveWT = Util.getCmp("处理未同步"), btnSaveWT && btnSaveWT.on("click", this.OnSaveWTB, this), grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnSaveWTB: function() {
          var mask;
          Msg.Confirm("确定同步吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseCheckoutHandler.ashx",
              params: {
                sign: "SynchronousOrderReceipts"
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseReceiptQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "View", "Query", "History", "Delete"],
        items: "",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseReceiving = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Open", "Close", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data, flag = !1,
          ok = !1;
        return (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          if (data = item.raw, data.收货数量 = item.get("收货数量"), data.发货数量 = item.data.发货数量, data.收货数量 == 0) return flag = !0, !1;
          if (data.收货数量 > data.发货数量) return ok = !0, !1;
          items.push(data)
        }), flag) ? (Msg.Normal("收货数量不能为0,请检查选中的记录!"), !1) : ok ? (Msg.Normal("收货数量异常,请检查选中的记录!"), !1) : (obj.采购发货单 = items, obj)
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("批量收货"),
              text: "批量收货",
              iconCls: "icon-add"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("批量收货");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.on("edit", this.OnGridEdit, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this);
          grid.store.on("load", this.OnGridStoreLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.PurchaseReceiving.Common.PackData(), data !== !1) && Msg.Confirm("确定收货吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseInvoiceHandler.ashx",
              params: {
                sign: "SavePurchaseInvoice",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridBeforeEdit: function(editor, e) {
          if (["收货数量", "收货时间"].indexOf(e.field) == -1) return !1
        },
        OnGridEdit: function(editor, e) {
          ["收货数量"].indexOf(e.field) != -1
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        },
        OnGridStoreLoad: function(store, records) {
          Ext.each(records, function(item) {
            item.set("收货数量", item.get("发货数量"))
          })
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseReceivingClose = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Open", "Close", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {},
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseReceivingCopy = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data, flag = !1,
          ok = !1;
        return (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          if (data = item.raw, data.收货数量 = item.get("收货数量"), data.发货数量 = item.data.发货数量, data.收货数量 == 0) return flag = !0, !1;
          if (data.收货数量 > data.发货数量) return ok = !0, !1;
          data.变更 = item.get("变更"), items.push(data)
        }), flag) ? (Msg.Normal("收货数量不能为0,请检查选中的记录!"), !1) : ok ? (Msg.Normal("收货数量异常,请检查选中的记录!"), !1) : (obj.采购发货单 = items, obj)
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("批量收货"),
              text: "批量收货",
              iconCls: "icon-add"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("批量收货");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.on("edit", this.OnGridEdit, this);
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this);
          grid.store.on("load", this.OnGridStoreLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.PurchaseReceiving.Common.PackData(), data !== !1) && Msg.Confirm("确定收货吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseInvoiceHandler.ashx",
              params: {
                sign: "SavePurchaseInvoice",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridBeforeEdit: function(editor, e) {
          if (["收货数量", "收货时间"].indexOf(e.field) == -1) return !1
        },
        OnGridEdit: function(editor, e) {
          ["收货数量"].indexOf(e.field) != -1 && e.record.set("变更", !0)
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        },
        OnGridStoreLoad: function(store, records) {
          Ext.each(records, function(item) {
            item.set("收货数量", item.get("发货数量")), item.set("变更", !0)
          })
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseStorageQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Open", "Close", "Start", "Stop", "Handler", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("打印"),
              text: "打印",
              disabled: !0,
              iconCls: "icon-print"
            })
          })
        }
      },
      After: {
        Init: function() {
          var btnPrint, grid;
          btnPrint = Util.getCmp("打印"), btnPrint && btnPrint.on("click", this.OnPrint, this), grid = Util.getCmp("Grid");
          grid.on("select", this.OnGridSelect, this);
          grid.on("deselect", this.OnGridSelect, this)
        },
        OnPrint: function() {
          var grid, record, items = [];
          grid = Util.getCmp("Grid"), record = grid.selModel.getSelection(), Ext.each(record, function(item) {
            items.push(item.get("ID"))
          }), record && open("/Prints/Views/cgrkd.htm?id=" + Snmon.USERID2 + "&ids=" + items)
        },
        OnGridSelect: function(rowModel) {
          var btnPrint;
          btnPrint = Util.getCmp("打印"), rowModel.getSelection().length == 0 ? btnPrint && btnPrint.disable() : btnPrint && btnPrint.enable()
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseStorageQueryStop = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "View", "Pass", "Redo", "Start", "Stop", "Handler", "History"],
        items: "",
        ShowQuery: !1,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("打印"),
              text: "打印",
              disabled: !0,
              iconCls: "icon-print"
            })
          })
        }
      },
      After: {
        Init: function() {
          var btnPrint, grid;
          btnPrint = Util.getCmp("打印"), btnPrint && btnPrint.on("click", this.OnPrint, this), grid = Util.getCmp("Grid");
          grid.on("select", this.OnGridSelect, this);
          grid.on("deselect", this.OnGridSelect, this)
        },
        OnPrint: function() {
          var grid, record, items = [];
          grid = Util.getCmp("Grid"), record = grid.selModel.getSelection(), Ext.each(record, function(item) {
            items.push(item.get("ID"))
          }), record && open("/Prints/Views/cgrkd.htm?id=" + Snmon.USERID2 + "&ids=" + items)
        },
        OnGridSelect: function(rowModel) {
          var btnPrint, btnDelete;
          btnPrint = Util.getCmp("打印"), btnDelete = Util.getCmp("ButtonDelete"), rowModel.getSelection().length == 0 ? (btnPrint && btnPrint.disable(), btnDelete && btnDelete.disable()) : (btnPrint && btnPrint.enable(), btnDelete && btnDelete.enable())
        }
      }
    }
  }
}(),
function() {
  Snmon.RejectionReportQuery = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        RemoveButtons: ["Add", "Delete", "View", "Pass", "Redo", "Start", "Stop", "Handler", "Query", "History", "Open", "Close"],
        items: "",
        ShowQuery: !1
      }), this.Render.Init(), this.Event.After.Init(), Util.getCmp("Grid").store.loadPage(1)
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data;
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          data = item.raw, items.push(data)
        }), obj.采购检验单来源 = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("不良品退货"),
              text: "不良品退货",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btnSave, grid;
          btnSave = Util.getCmp("不良品退货");
          btnSave.on("click", this.OnSave, this);
          grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridStoreBeforeLoad, this)
        },
        OnSave: function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var data, mask;
          (data = Snmon.RejectionReportQuery.Common.PackData(), data !== !1) && Msg.Confirm("确定退货吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/PurchaseCheckoutHandler.ashx",
              params: {
                sign: "SaveRejectionReportQuery",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result == "OK" ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        OnGridStoreBeforeLoad: function(store) {
          store.setExtraParams("dataShowWay", "信息展示")
        }
      }
    }
  }
}(),
function() {
  Snmon.TestCycleList = {
    Load: function() {
      this.Event.Before.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0
      })
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientlistedit", this.OnListEdit, this)
        },
        OnListEdit: function() {
          var _物料号Cmp = Util.getPCmp("物料号");
          _物料号Cmp.on("clientbeforeshow", this.OnBeforeShow, this);
          _物料号Cmp.on("clientquerybeforeload", this.OnQueryBeforeLoad, this)
        },
        OnBeforeShow: function() {
          var _公司Cmp, _公司;
          return _公司Cmp = Util.getPCmp("公司"), _公司 = _公司Cmp.xtype == "ComboBoxExterior" ? _公司Cmp.clientdata.ID : _公司Cmp.getValue(), _公司 ? void 0 : (Msg.Normal("请录入公司!"), !1)
        },
        OnQueryBeforeLoad: function(store) {
          var panel, _公司;
          panel = Util.getCmp("Panel"), _公司 = panel.Data[panel.boName].公司ID, store.setExtraParams("company", _公司)
        }
      }
    }
  }
}(),
function() {
  Snmon.BatchQualifiedQuery = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render({
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var btnGridSearch = Util.getCmp("ButtonGridSearch");
        delete btnGridSearch.keys.起始时间, btnGridSearch.fields.remove("起始时间"), delete btnGridSearch.keys.结束时间, btnGridSearch.fields.remove("结束时间")
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforecomboboxexpandcreate", this.BeforeComboboxExpandCreate, this)
        },
        BeforeComboboxExpandCreate: function(o) {
          o.property == "公司名称" && (o.store = ["", "厨具", "实业", "厨电", "工贸"], o.value = "")
        }
      },
      After: {
        Init: function() {
          var grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnLoad, this)
        },
        OnLoad: function(store) {
          var _起始时间Cmp, _起始时间, _结束时间Cmp, _结束时间, grid, data = {};
          grid = Util.getCmp("Grid"), _起始时间Cmp = Util.getCmp("QueryComplexFormGrid_起始时间"), _起始时间Cmp && (_起始时间 = _起始时间Cmp.getValue()), _结束时间Cmp = Util.getCmp("QueryComplexFormGrid_结束时间"), _结束时间Cmp && (_结束时间 = _结束时间Cmp.getValue()), data[grid.boName] = {
            "起始时间": _起始时间,
            "结束时间": _结束时间
          }, store.setExtraParams("filterObjectData", Ext.encode(data))
        }
      }
    }
  }
}(),
function() {
  Snmon.CJStorageReport = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render({
        multiSelect: !0,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.OEMProductionPurchaseNoReport = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render({
        RemoveButtons: ["Query", "Export", "History"],
        multiSelect: !0,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide(), Util.getCmp("Grid").view.getRowClass = function(record) {
          return record.raw.完结状态 == "已完结" ? "grid-row-gray-style" : record.raw.订单数量 > record.raw.已安排采购数量 ? "grid-row-green-style" : void 0
        }
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data;
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          data = item.raw, items.push(data)
        }), obj.OEM生产采购查询 = items, obj
      },
      PackBOMData: function() {
        var grid, records, obj = {},
          items = [],
          data;
        return grid = Util.getCmp("GridList"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          data = item.data, items.push(data)
        }), obj.SAPBOM = items, obj
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(0, {
              id: Util.id("完结"),
              text: "完结",
              iconCls: "icon-save"
            }), toolbar.insert(1, {
              id: Util.id("反完结"),
              text: "反完结",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var btn反完结 = Util.getCmp("反完结"),
            btn完结;
          btn反完结.on("click", this.On完结处理Click, this);
          btn完结 = Util.getCmp("完结");
          btn完结.on("click", this.On完结处理Click, this)
        },
        "On完结处理Click": function(m) {
          var grid, records, data, mask;
          if (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), records.length == 0) {
            Msg.Normal("请选择记录!");
            return
          }(data = Snmon.OEMProductionPurchaseReport.Common.PackData(), data !== !1) && Msg.Confirm("确定完结处理吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/OEMQuerySapHandler.ashx",
              params: {
                sign: "完结处理",
                data: Ext.encode(data),
                "完结状态": m.text
              },
              success: function(r) {
                var result = Ext.decode(r.responseText);
                result.success ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result.msg), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        }
      }
    }
  }
}(),
function() {
  Snmon.OEMProductionPurchaseReport = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render({
        RemoveButtons: ["Query", "Export", "History"],
        multiSelect: !0,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide(), Util.getCmp("Grid").view.getRowClass = function(record) {
          return record.raw.打开关闭状态 == "关闭" ? "grid-row-gray-style" : record.raw.是否BOM主体 == !0 && record.raw.是否已解析BOM == !1 ? "grid-row-green-style" : void 0
        }
      }
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [],
          data, flag = !1;
        return (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          if (data = item.raw, data.供应商代号 = item.data.供应商代号, data.采购数量 = item.data.采购数量, data.采购交期 = item.data.采购交期, data.采购组织 = item.data.采购组织, data.产品名称 = item.data.产品名称, data.产品型号 = item.data.产品型号, data.采购组 = item.data.采购组, data.仓库 = item.data.仓库, data.生产公司 = item.data.生产公司, data.采购数量 == 0) return flag = !0, !1;
          items.push(data)
        }), flag) ? (Msg.Normal("采购数量不能为0,请检查选中的记录!"), !1) : (obj.OEM生产采购查询 = items, obj)
      },
      PackBOMData: function() {
        var grid, records, obj = {},
          items = [],
          data, flag = 0;
        return (grid = Util.getCmp("GridList"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          item.data.是否OEM配件主体 == !0 && flag++, data = item.data, items.push(data)
        }), flag != 1) ? (Msg.Normal("OEM配件主体只能勾选一个!"), !1) : (obj.SAPBOM = items, obj)
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this), Util.OnComponent("clienttoolbar", function() {
            var toolbar = Util.getCmp("Toolbar");
            toolbar.insert(-1, {
              id: Util.id("查看BOM"),
              text: "查看BOM",
              iconCls: "icon-save"
            }), toolbar.insert(0, {
              id: Util.id("转SAP采购"),
              text: "转SAP采购",
              iconCls: "icon-save"
            }), toolbar.insert(0, {
              id: Util.id("合并转SAP采购"),
              text: "合并转SAP采购",
              iconCls: "icon-save"
            }), toolbar.insert(2, {
              id: Util.id("打开"),
              text: "打开",
              iconCls: "icon-save"
            }), toolbar.insert(2, {
              id: Util.id("关闭"),
              text: "关闭",
              iconCls: "icon-save"
            })
          })
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var grid = Util.getCmp("Grid"),
            btn查看BOM, btn打开, btn关闭, btn转SAP采购, btn合并转SAP采购;
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.store.on("load", this.OnGridStoreLoad, this);
          grid.on("select", this.OnGridSelect, this);
          grid.on("deselect", this.OnGridSelect, this);
          btn查看BOM = Util.getCmp("查看BOM");
          btn查看BOM.on("click", this.On查看BOMClick, this);
          btn打开 = Util.getCmp("打开");
          btn打开.on("click", this.On打开关闭Click, this, "打开");
          btn关闭 = Util.getCmp("关闭");
          btn关闭.on("click", this.On打开关闭Click, this, "关闭");
          btn转SAP采购 = Util.getCmp("转SAP采购");
          btn转SAP采购.on("click", this.On转SAP采购Click, this);
          btn合并转SAP采购 = Util.getCmp("合并转SAP采购");
          btn合并转SAP采购.on("click", this.On合并转SAP采购Click, this);
          if (_供应商代号Cmp = Util.getCmp("Grid_供应商代号"), _供应商代号Cmp) _供应商代号Cmp.on("clientquerybeforeload", this.On供应商代号QueryBeforeLoad, this)
        },
        "On_是否OEM配件主体CmpBeforeValue": function() {},
        "On打开关闭Click": function(m) {
          var grid, records, data, mask;
          if (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), records.length == 0) {
            Msg.Normal("请选择记录!");
            return
          }(data = Snmon.OEMProductionPurchaseReport.Common.PackData(), data !== !1) && Msg.Confirm("确定打开关闭处理吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/OEMQuerySapHandler.ashx",
              params: {
                sign: "打开关闭处理",
                data: Ext.encode(data),
                "打开关闭状态": m.text
              },
              success: function(r) {
                var result = Ext.decode(r.responseText);
                result.success ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result.msg), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        "On合并转SAP采购Click": function() {
          var grid, records, obj = {},
            items = [],
            合并数量 = 0;
          if (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), records.length <= 1) {
            Msg.Normal("请选择2条或以上记录!");
            return
          }
          var 物料信息 = "",
            采购公司 = "",
            _物料是否一致 = !0;
          if (Ext.each(records, function(item) {
              if (data = item.raw, data.采购数量 = item.data.采购数量, 物料信息 == "" && (物料信息 = data.物料编码), 采购公司 == "" && (采购公司 = item.data.生产公司), 物料信息 != data.物料编码 || 采购公司 != item.data.生产公司) return _物料是否一致 = !1, !1;
              合并数量 += Number.FloatSubt(item.get("主配件数量") == 0 ? item.get("订单数量") : item.get("主配件数量"), item.get("已安排采购数量")), items.push(data)
            }), _物料是否一致 == !1) {
            Msg.Normal("请选择相同的采购物料!");
            return
          }
          obj.OEM生产采购查询 = items, win = Util.getCmp("合并采购信息"), win || (win = win = Ext.create("Ext.window.Window", {
            id: Util.id("合并采购信息"),
            title: "合并采购信息",
            width: 320,
            height: 280,
            constrainHeader: !0,
            closable: !1,
            resizable: !1,
            modal: Config.modal,
            items: [{
              xtype: "textfield",
              id: Util.id("t_采购公司"),
              fieldLabel: "采购公司",
              store: [
                ["Enable", "Enable"]
              ],
              value: ""
            }, {
              xtype: "textfield",
              id: Util.id("t_供应商代号"),
              fieldLabel: "供应商代号",
              value: ""
            }, {
              xtype: "numberfield",
              id: Util.id("t_采购数量"),
              fieldLabel: "采购数量",
              value: 合并数量
            }, {
              xtype: "datefield",
              format: "Y-m-d",
              id: Util.id("t_采购时间"),
              fieldLabel: "采购时间",
              value: items[0].交货日期
            }, {
              xtype: "textfield",
              id: Util.id("t_采购组织"),
              fieldLabel: "采购组织",
              value: "1000"
            }, {
              xtype: "textfield",
              id: Util.id("t_采购组"),
              fieldLabel: "采购组",
              value: ""
            }, {
              xtype: "textfield",
              id: Util.id("t_仓库"),
              fieldLabel: "仓库",
              value: ""
            }],
            bbar: ["->", {
              text: "确认",
              iconCls: "icon-accept",
              handler: function() {
                var _供应商代号 = Util.getCmp("t_供应商代号").value,
                  _采购数量 = Util.getCmp("t_采购数量").value,
                  _采购时间 = Util.getCmp("t_采购时间").value,
                  _采购组织 = Util.getCmp("t_采购组织").value,
                  _采购组 = Util.getCmp("t_采购组").value,
                  _仓库 = Util.getCmp("t_仓库").value,
                  _采购公司 = Util.getCmp("t_采购公司").value;
                if (_供应商代号 == "" || _采购组 == "" || _仓库 == "" || _采购组织 == "") {
                  Msg.Normal("请完整填写采购信息!");
                  return
                }
                mask = new Ext.LoadMask(Ext.getBody(), {
                  msg: "处理中,请稍等..."
                }), mask.show(), Ext.Ajax.request({
                  timeout: Config.timeout,
                  method: "POST",
                  url: Config.VPath + "WebServices/Operation/OperationViews/OEMQuerySapHandler.ashx",
                  params: {
                    sign: "合并转SAP采购",
                    "obj_采购数据": Ext.encode(obj),
                    "obj_供应商代号": _供应商代号,
                    "obj_采购数量": _采购数量,
                    "obj_采购时间": _采购时间,
                    "obj_采购组织": _采购组织,
                    "obj_采购组": _采购组,
                    "obj_采购公司": _采购公司,
                    "obj_仓库": _仓库
                  },
                  success: function(r) {
                    var result = Ext.decode(r.responseText);
                    result.success ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result.msg), mask.hide()
                  },
                  failure: function(r) {
                    mask.hide(), Msg.Failure(r.responseText)
                  }
                }), Util.Destroy("合并采购信息"), Util.WindowHideOrClose(win)
              }
            }, {
              text: "取消",
              iconCls: "icon-close",
              handler: function() {
                Util.Destroy("合并采购信息"), Util.WindowHideOrClose(win)
              }
            }]
          })), win.show();
          return
        },
        "On转SAP采购Click": function() {
          var grid, records, data, mask;
          if (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), records.length == 0) {
            Msg.Normal("请选择记录!");
            return
          }(data = Snmon.OEMProductionPurchaseReport.Common.PackData(), data !== !1) && Msg.Confirm("确定转SAP采购吗?", function(val) {
            val == "ok" && (mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/OEMQuerySapHandler.ashx",
              params: {
                sign: "转SAP采购",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = Ext.decode(r.responseText);
                result.success || Msg.Normal(result.msg), Util.getCmp("Grid").store.loadPage(1), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            }))
          })
        },
        "On供应商代号QueryBeforeLoad": function(store) {
          var grid = Util.getCmp("Grid"),
            t = Util.getCmp("Grid").selModel.getLastSelected();
          store.proxy.setExtraParam("物料代码", t.raw.物料编码), store.proxy.setExtraParam("公司代码", t.data.生产公司)
        },
        OnGridSelect: function(rowModel) {
          var btn查看BOMCmp = Util.getCmp("查看BOM"),
            btn合并转SAP采购Cmp = Util.getCmp("合并转SAP采购"),
            btn转SAP采购Cmp = Util.getCmp("转SAP采购"),
            records = rowModel.getSelection();
          if (records.length == 1 && records[0].raw.是否BOM主体 == !0 && records[0].raw.是否已解析BOM == !1 && records[0].raw.打开关闭状态 == "打开" && records[0].raw.物料描述 ? btn查看BOMCmp && btn查看BOMCmp.show() : btn查看BOMCmp && btn查看BOMCmp.hide(), records.length > 1) {
            var 是否有关闭数据 = !1,
              是否相同物料 = !0,
              物料号 = "";
            Ext.each(records, function(item) {
              item.raw.打开关闭状态 != "关闭" && item.raw.物料描述 || (是否有关闭数据 = !0), 物料号 == "" && (物料号 = item.raw.主配件物料编码 ? item.raw.主配件物料编码 : item.raw.物料编码), 物料号 != (item.raw.主配件物料编码 ? item.raw.主配件物料编码 : item.raw.物料编码) && (是否相同物料 = !1)
            }), 是否有关闭数据 == !1 ? (是否相同物料 == !0 && btn合并转SAP采购Cmp && btn合并转SAP采购Cmp.show(), btn转SAP采购Cmp && btn转SAP采购Cmp.show()) : (btn合并转SAP采购Cmp && btn合并转SAP采购Cmp.hide(), btn转SAP采购Cmp && btn转SAP采购Cmp.hide())
          } else btn合并转SAP采购Cmp && btn合并转SAP采购Cmp.hide(), records.length == 1 && records[0].raw.打开关闭状态 == "打开" && records[0].raw.物料描述 ? btn转SAP采购Cmp && btn转SAP采购Cmp.show() : btn转SAP采购Cmp && btn转SAP采购Cmp.hide()
        },
        OnGridBeforeEdit: function(editor, e) {
          if (["供应商代号", "采购数量", "采购交期", "采购组织", "采购组", "仓库", "生产公司"].indexOf(e.field) == -1) return !1
        },
        "On查看BOMClick": function() {
          if (Util.getCmp("Grid").selModel.getSelection().length == 0) {
            Msg.Normal("请选择记录!");
            return
          }
          var grid = Util.getCmp("Grid"),
            列数据 = Util.getCmp("Grid").selModel.getLastSelected().raw,
            t = Util.CreateGrid({
              gridId: "GridList",
              url: "WebServices/Operation/OperationViews/OEMQuerySapHandler.ashx",
              isColumnColor: !0,
              boName: "SAPBOM",
              region: "south",
              canEditor: !0,
              multiSelect: !0,
              addRow: !1,
              copyRow: !1,
              delRow: !1,
              height: 400,
              extraParams: {
                sign: "queryBOM",
                cName: "/OperationViews/Report/OEMProductionPurchaseReport.aspx/GridList",
                boName: "BOM列表",
                dataShowWay: "信息展示",
                "物料编码": 列数据.物料编码,
                "生产公司": Util.getCmp("Grid").selModel.getLastSelected().data.生产公司
              }
            });
          _是否OEM配件主体Cmp = Util.getCmp("GridList_是否OEM配件主体"), _是否OEM配件主体Cmp && _是否OEM配件主体Cmp.on("clientvalue", this.On_是否OEM配件主体CmpBeforeValue, this), win = Util.getCmp("生产BOM信息"), win || (win = win = Ext.create("Ext.window.Window", {
            id: Util.id("生产BOM信息"),
            title: "",
            width: 620,
            height: 480,
            constrainHeader: !0,
            closable: !1,
            resizable: !1,
            modal: Config.modal,
            items: [t],
            bbar: ["->", {
              text: "确认",
              iconCls: "icon-accept",
              handler: function() {
                if (Util.getCmp("GridList").selModel.getSelection().length == 0) {
                  Msg.Normal("请选择BOM记录!");
                  return
                }
                var BOMdata = Snmon.OEMProductionPurchaseReport.Common.PackBOMData();
                BOMdata != !1 && (mask = new Ext.LoadMask(Ext.getBody(), {
                  msg: "处理中,请稍等..."
                }), mask.show(), Ext.Ajax.request({
                  timeout: Config.timeout,
                  method: "POST",
                  url: Config.VPath + "WebServices/Operation/OperationViews/OEMQuerySapHandler.ashx",
                  params: {
                    sign: "解析BOM配件",
                    BOMdata: Ext.encode(BOMdata),
                    "OA生产标示": 列数据.OA生产计划标示
                  },
                  success: function(r) {
                    var result = Ext.decode(r.responseText);
                    result.success ? Util.getCmp("Grid").store.loadPage(1) : Msg.Normal(result.msg), mask.hide()
                  },
                  failure: function(r) {
                    mask.hide(), Msg.Failure(r.responseText)
                  }
                }), Util.Destroy("GridList"), Util.WindowHideOrClose(win))
              }
            }, {
              text: "取消",
              iconCls: "icon-close",
              handler: function() {
                Util.Destroy("GridList"), Util.WindowHideOrClose(win)
              }
            }]
          })), t.store.load(), win.show();
          return
        },
        OnGridStoreLoad: function(store, records) {
          Ext.each(records, function(item) {
            item.set("采购数量", Number.FloatSubt(item.get("主配件数量") == 0 ? item.get("订单数量") : item.get("主配件数量"), item.get("已安排采购数量"))), item.set("采购交期", item.get("交货日期")), item.set("采购组织", "1000"), item.set("采购组", "")
          })
        }
      }
    }
  }
}(),
function() {
  Snmon.OverdueDeliveryOrders = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [];
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          var data = item.data;
          data.责任ID = item.get("责任"), Ext.applyIf(data, item.raw), items.push(data)
        }), obj.逾期未到货的订单 = items, obj
      }
    },
    Render: {
      Init: function() {
        var btnGridSearch, toolbar, grid;
        btnGridSearch = Util.getCmp("ButtonGridSearch2"), toolbar = Util.getCmp("Toolbar"), toolbar.insert(0, {
          id: Util.id("ButtonReturnSuperior"),
          iconCls: "icon-last",
          text: "返回上级"
        }), toolbar.insert(4, {
          id: Util.id("ButtonSave"),
          iconCls: "icon-save",
          text: "保存"
        }), grid = Util.getCmp("Grid"), Ext.each(grid.columns, function(item, index) {
          index > 1 && ["公司", "逾期笔数"].indexOf(item.dataIndex) == -1 ? grid.columns[index].hide() : grid.columns[index].show()
        })
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforecomboboxexpandcreate", this.BeforeComboboxExpandCreate, this), Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this)
        },
        BeforeComboboxExpandCreate: function(o) {
          var items, i;
          if (o.ctype == "comboboxexpand")
            if (o.property == "年份") {
              for (items = [], i = Snmon.StartYear; i <= Snmon.EndYear; i++) items.push(i);
              o.store = items, o.value = Snmon.CurrentYear
            } else o.property == "月份" ? (o.store = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], o.value = Snmon.CurrentMonth) : o.property == "公司" && (o.store = ["", "1000", "1100", "1200", "1900"], o.value = "")
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var grid, btnReturnSuperior, btnExport, btnSave;
          grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.store.on("beforeload", this.OnGridBeforeLoad, this);
          grid.on("itemdblclick", this.OnGridItemDblClick, this);
          btnSave = Util.getCmp("ButtonSave"), btnSave && btnSave.on("click", this.OnSave, this), btnReturnSuperior = Util.getCmp("ButtonReturnSuperior");
          btnReturnSuperior.on("click", this.OnReturnSuperiorClick, this);
          btnGridSearch = Util.getCmp("ButtonGridSearch");
          btnGridSearch.on("clientbeforequery", this.OnGridSearchBeforeQuery, this);
          btnExport = Util.getCmp("ButtonExport");
          btnExport.on("clientbeforeparams", this.OnBeforeParams, this)
        },
        OnSave: function() {
          var grid, records, mask, data;
          if (grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), records.length != 0) {
            if (data = Snmon.OverdueDeliveryOrders.Common.PackData(), data === !1) return;
            mask = new Ext.LoadMask(Ext.getBody(), {
              msg: "处理中,请稍等..."
            }), mask.show(), Ext.Ajax.request({
              timeout: Config.timeout,
              method: "POST",
              url: Config.VPath + "WebServices/Operation/OperationViews/SAPPurchaseOrderSynchHandler.ashx",
              params: {
                sign: "Saveyuqi",
                data: Ext.encode(data)
              },
              success: function(r) {
                var result = r.responseText;
                result.msg != "" ? (Msg.Normal(result), Util.getCmp("Grid").store.loadPage(1)) : Msg.Normal(result), mask.hide()
              },
              failure: function(r) {
                mask.hide(), Msg.Failure(r.responseText)
              }
            })
          } else {
            Msg.Normal("请选择记录!");
            return
          }
        },
        OnGridBeforeEdit: function(editor, e) {
          if (e.field != "逾期原因" && e.field != "责任") return !1
        },
        OnGridBeforeLoad: function(store, options) {
          var _公司 = "",
            _供应商编号 = "",
            grid, data = {},
            btnGridSearch, record, isSortChange;
          options.sorters.length > 0 && (!store.上次排序属性 || store.上次排序属性.property != options.sorters[0].property || store.上次排序属性.direction != options.sorters[0].direction) && (isSortChange = !0, store.上次排序属性 = options.sorters[0]), btnGridSearch = Util.getCmp("ButtonGridSearch"), grid = Util.getCmp("Grid"), grid.store.getCount() && btnGridSearch.query !== !0 && isSortChange !== !0 ? (record = grid.selModel.getLastSelected(), record ? (_公司 = record.get("公司"), _供应商编号 = record.get("供应商编号"), grid.上级 && (_供应商编号 ? (delete grid.供应商编号, _公司 = _公司, _供应商编号 = "") : _公司 && (delete grid.公司, delete grid.供应商编号, _公司 = "", _供应商编号 = ""))) : grid.上级 && (grid.供应商编号 ? (delete grid.供应商编号, _公司 = grid.公司, _供应商编号 = "") : grid.公司 && (delete grid.公司, delete grid.供应商编号, _公司 = "", _供应商编号 = ""))) : (_公司 = grid.公司 || "", _供应商编号 = grid.供应商编号 || ""), data[grid.boName] = {
            "公司": _公司,
            "供应商编号": _供应商编号
          }, grid.store.setExtraParams("filterObjectData", Ext.encode(data)), delete btnGridSearch.query, delete grid.上级
        },
        OnGridItemDblClick: function(view, record) {
          var propertys, btn;
          record && !record.raw.采购单号 && (propertys = [], view.panel.公司 = record.get("公司"), view.panel.供应商编号 = record.get("供应商编号"), view.panel.供应商编号 ? propertys = [] : view.panel.公司 && (propertys = ["公司", "供应商编号", "逾期笔数"]), Ext.each(view.panel.columns, function(item, index) {
            index > 1 && (propertys.length > 0 && propertys.indexOf(item.dataIndex) == -1 ? view.panel.columns[index].hide() : propertys.length == 0 && item.dataIndex == "逾期笔数" ? view.panel.columns[index].hide() : view.panel.columns[index].show())
          }), btn = Util.getCmp("ButtonGridSearch"), btn.query = !1, btn.fireEvent("click", btn))
        },
        OnReturnSuperiorClick: function() {
          var grid, record, btn;
          grid = Util.getCmp("Grid"), grid.store.getCount() && (record = grid.selModel.getLastSelected() || grid.store.getAt(0), record && (record.raw.采购单号 || record.raw.供应商编号) && (grid.上级 = !0, record.raw.采购单号 ? propertys = ["公司", "供应商编号", "逾期笔数"] : record.raw.供应商编号 && (propertys = ["公司", "逾期笔数"]), Ext.each(grid.columns, function(item, index) {
            index > 1 && (propertys.length > 0 && propertys.indexOf(item.dataIndex) == -1 ? grid.columns[index].hide() : grid.columns[index].show())
          }))), btn = Util.getCmp("ButtonGridSearch"), btn.query = !1, btn.fireEvent("click", btn)
        },
        OnGridSearchBeforeQuery: function(el) {
          el.query !== !1 && (el.query = !0)
        },
        OnBeforeParams: function() {
          var grid = Util.getCmp("Grid")
        }
      }
    }
  }
}(),
function() {
  Snmon.PurchaseCounterReport = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render({
        RemoveButtons: ["Query"],
        multiSelect: !0,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var state = Util.getCmp("ComboBoxState");
        state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.PurchaseOrderStatus = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render({
        autoLoad: !1
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.ReceiptReport = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render({
        multiSelect: !0,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {}
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {}
      }
    }
  }
}(),
function() {
  Snmon.SupplierOrder = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render({
        multiSelect: !0,
        autoLoad: !0
      }), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var toolbar, state;
        toolbar = Util.getCmp("Toolbar"), toolbar.insert(0, {
          id: Util.id("ButtonPrint"),
          text: "打印",
          disabled: !0,
          iconCls: "icon-print"
        }), state = Util.getCmp("ComboBoxState"), state && state.hide()
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {
          var btnPrint, grid;
          btnPrint = Util.getCmp("ButtonPrint"), btnPrint && btnPrint.on("click", this.OnPrint, this), grid = Util.getCmp("Grid");
          grid.on("select", this.OnGridSelect, this);
          grid.on("deselect", this.OnGridSelect, this)
        },
        OnPrint: function() {
          var grid, record, items = [];
          grid = Util.getCmp("Grid"), record = grid.selModel.getSelection(), Ext.each(record, function(item) {
            items.push(item.raw.采购单ID)
          }), record && open("/Prints/Views/cggysdd.htm?id=" + Snmon.USERID2 + "&ids=" + items)
        },
        OnGridSelect: function(rowModel) {
          var btnPrint;
          btnPrint = Util.getCmp("ButtonPrint"), rowModel.getSelection().length == 0 ? btnPrint && btnPrint.disable() : btnPrint && btnPrint.enable()
        }
      }
    }
  }
}(),
function() {
  Snmon.SupplierOverdueDeliveryOrders = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Common: {
      PackData: function() {
        var grid, records, obj = {},
          items = [];
        return grid = Util.getCmp("Grid"), records = grid.selModel.getSelection(), Ext.each(records, function(item) {
          var data = item.data;
          data.责任ID = item.get("责任"), Ext.applyIf(data, item.raw), items.push(data)
        }), obj.供应商逾期未确认订单 = items, obj
      }
    },
    Render: {
      Init: function() {
        var btnGridSearch, toolbar, grid;
        btnGridSearch = Util.getCmp("ButtonGridSearch2"), toolbar = Util.getCmp("Toolbar"), toolbar.insert(0, {
          id: Util.id("ButtonReturnSuperior"),
          iconCls: "icon-last",
          text: "返回上级"
        }), grid = Util.getCmp("Grid"), Ext.each(grid.columns, function(item, index) {
          index > 1 && ["公司", "逾期笔数"].indexOf(item.dataIndex) == -1 ? grid.columns[index].hide() : grid.columns[index].show()
        })
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforecomboboxexpandcreate", this.BeforeComboboxExpandCreate, this), Util.OnComponent("clientbeforegridcreate", this.OnBeforeGridCreate, this)
        },
        BeforeComboboxExpandCreate: function(o) {
          var items, i;
          if (o.ctype == "comboboxexpand")
            if (o.property == "年份") {
              for (items = [], i = Snmon.StartYear; i <= Snmon.EndYear; i++) items.push(i);
              o.store = items, o.value = Snmon.CurrentYear
            } else o.property == "月份" ? (o.store = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], o.value = Snmon.CurrentMonth) : o.property == "公司" && (o.store = ["", "1000", "1100", "1200", "1900"], o.value = "")
        },
        OnBeforeGridCreate: function(config) {
          config.id == "Grid" && (config.canEditor = !0, config.isColumnColor = !0)
        }
      },
      After: {
        Init: function() {
          var grid, btnReturnSuperior, btnExport;
          grid = Util.getCmp("Grid");
          grid.on("beforeedit", this.OnGridBeforeEdit, this);
          grid.store.on("beforeload", this.OnGridBeforeLoad, this);
          grid.on("itemdblclick", this.OnGridItemDblClick, this);
          btnReturnSuperior = Util.getCmp("ButtonReturnSuperior");
          btnReturnSuperior.on("click", this.OnReturnSuperiorClick, this);
          btnGridSearch = Util.getCmp("ButtonGridSearch");
          btnGridSearch.on("clientbeforequery", this.OnGridSearchBeforeQuery, this);
          btnExport = Util.getCmp("ButtonExport");
          btnExport.on("clientbeforeparams", this.OnBeforeParams, this)
        },
        OnGridBeforeEdit: function(editor, e) {
          if (e.field != "逾期原因" && e.field != "责任") return !1
        },
        OnGridBeforeLoad: function(store, options) {
          var _公司 = "",
            _供应商编号 = "",
            grid, data = {},
            btnGridSearch, record, isSortChange;
          options.sorters.length > 0 && (!store.上次排序属性 || store.上次排序属性.property != options.sorters[0].property || store.上次排序属性.direction != options.sorters[0].direction) && (isSortChange = !0, store.上次排序属性 = options.sorters[0]), btnGridSearch = Util.getCmp("ButtonGridSearch"), grid = Util.getCmp("Grid"), grid.store.getCount() && btnGridSearch.query !== !0 && isSortChange !== !0 ? (record = grid.selModel.getLastSelected(), record ? (_公司 = record.get("公司"), _供应商编号 = record.get("供应商编号"), grid.上级 && (_供应商编号 ? (delete grid.供应商编号, _公司 = _公司, _供应商编号 = "") : _公司 && (delete grid.公司, delete grid.供应商编号, _公司 = "", _供应商编号 = ""))) : grid.上级 && (grid.供应商编号 ? (delete grid.供应商编号, _公司 = grid.公司, _供应商编号 = "") : grid.公司 && (delete grid.公司, delete grid.供应商编号, _公司 = "", _供应商编号 = ""))) : (_公司 = grid.公司 || "", _供应商编号 = grid.供应商编号 || ""), data[grid.boName] = {
            "公司": _公司,
            "供应商编号": _供应商编号
          }, grid.store.setExtraParams("filterObjectData", Ext.encode(data)), delete btnGridSearch.query, delete grid.上级
        },
        OnGridItemDblClick: function(view, record) {
          var propertys, btn;
          record && !record.raw.采购单号 && (propertys = [], view.panel.公司 = record.get("公司"), view.panel.供应商编号 = record.get("供应商编号"), view.panel.供应商编号 ? propertys = [] : view.panel.公司 && (propertys = ["公司", "供应商编号", "逾期笔数"]), Ext.each(view.panel.columns, function(item, index) {
            index > 1 && (propertys.length > 0 && propertys.indexOf(item.dataIndex) == -1 ? view.panel.columns[index].hide() : propertys.length == 0 && item.dataIndex == "逾期笔数" ? view.panel.columns[index].hide() : view.panel.columns[index].show())
          }), btn = Util.getCmp("ButtonGridSearch"), btn.query = !1, btn.fireEvent("click", btn))
        },
        OnReturnSuperiorClick: function() {
          var grid, record, btn;
          grid = Util.getCmp("Grid"), grid.store.getCount() && (record = grid.selModel.getLastSelected() || grid.store.getAt(0), record && (record.raw.采购单号 || record.raw.供应商编号) && (grid.上级 = !0, record.raw.采购单号 ? propertys = ["公司", "供应商编号", "逾期笔数"] : record.raw.供应商编号 && (propertys = ["公司", "逾期笔数"]), Ext.each(grid.columns, function(item, index) {
            index > 1 && (propertys.length > 0 && propertys.indexOf(item.dataIndex) == -1 ? grid.columns[index].hide() : grid.columns[index].show())
          }))), btn = Util.getCmp("ButtonGridSearch"), btn.query = !1, btn.fireEvent("click", btn)
        },
        OnGridSearchBeforeQuery: function(el) {
          el.query !== !1 && (el.query = !0)
        },
        OnBeforeParams: function() {
          var grid = Util.getCmp("Grid")
        }
      }
    }
  }
}(),
function() {
  Snmon.SuppliersToTheArrivalOfTheGoodsInTime = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var btnGridSearch, toolbar, grid;
        btnGridSearch = Util.getCmp("ButtonGridSearch"), toolbar = Util.getCmp("Toolbar"), toolbar.insert(0, {
          id: Util.id("ButtonReturnSuperior"),
          iconCls: "icon-last",
          text: "返回上级"
        }), grid = Util.getCmp("Grid"), Ext.each(grid.columns, function(item, index) {
          index > 1 && ["公司", "总笔数", "未达成笔数"].indexOf(item.dataIndex) == -1 ? grid.columns[index].hide() : grid.columns[index].show()
        })
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforecomboboxexpandcreate", this.BeforeComboboxExpandCreate, this)
        },
        BeforeComboboxExpandCreate: function(o) {
          var items, i;
          if (o.ctype == "comboboxexpand")
            if (o.property == "年份") {
              for (items = [], i = Snmon.StartYear; i <= Snmon.EndYear; i++) items.push(i);
              o.store = items, o.value = Snmon.CurrentYear
            } else o.property == "月份" ? (o.store = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], o.value = Snmon.CurrentMonth) : o.property == "公司" && (o.store = ["", "1000", "1100", "1200", "1900"], o.value = "")
        }
      },
      After: {
        Init: function() {
          var grid, btnReturnSuperior, btnExport;
          grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridBeforeLoad, this);
          grid.on("itemdblclick", this.OnGridItemDblClick, this);
          btnReturnSuperior = Util.getCmp("ButtonReturnSuperior");
          btnReturnSuperior.on("click", this.OnReturnSuperiorClick, this);
          btnGridSearch = Util.getCmp("ButtonGridSearch");
          btnGridSearch.on("clientbeforequery", this.OnGridSearchBeforeQuery, this);
          btnExport = Util.getCmp("ButtonExport");
          btnExport.on("clientbeforeparams", this.OnBeforeParams, this)
        },
        OnGridBeforeLoad: function(store, options) {
          var _公司 = "",
            _供应商编号 = "",
            grid, data = {},
            btnGridSearch, record, isSortChange;
          options.sorters.length > 0 && (!store.上次排序属性 || store.上次排序属性.property != options.sorters[0].property || store.上次排序属性.direction != options.sorters[0].direction) && (isSortChange = !0, store.上次排序属性 = options.sorters[0]), btnGridSearch = Util.getCmp("ButtonGridSearch"), grid = Util.getCmp("Grid"), grid.store.getCount() && btnGridSearch.query !== !0 && isSortChange !== !0 ? (record = grid.selModel.getLastSelected(), record ? (_公司 = record.get("公司"), _供应商编号 = record.get("供应商编号"), grid.上级 && (_供应商编号 ? (delete grid.供应商编号, _公司 = _公司, _供应商编号 = "") : _公司 && (delete grid.公司, delete grid.供应商编号, _公司 = "", _供应商编号 = ""))) : grid.上级 && (grid.供应商编号 ? (delete grid.供应商编号, _公司 = grid.公司, _供应商编号 = "") : grid.公司 && (delete grid.公司, delete grid.供应商编号, _公司 = "", _供应商编号 = ""))) : (_公司 = grid.公司 || "", _供应商编号 = grid.供应商编号 || ""), data[grid.boName] = {
            "公司": _公司,
            "供应商编号": _供应商编号
          }, grid.store.setExtraParams("filterObjectData", Ext.encode(data)), delete btnGridSearch.query, delete grid.上级
        },
        OnGridItemDblClick: function(view, record) {
          var propertys, btn;
          record && !record.raw.采购单号 && (propertys = [], view.panel.公司 = record.get("公司"), view.panel.供应商编号 = record.get("供应商编号"), view.panel.供应商编号 ? propertys = [] : view.panel.公司 && (propertys = ["公司", "供应商编号", "总笔数", "未达成笔数"]), Ext.each(view.panel.columns, function(item, index) {
            index > 1 && (propertys.length > 0 && propertys.indexOf(item.dataIndex) == -1 ? view.panel.columns[index].hide() : view.panel.columns[index].show())
          }), btn = Util.getCmp("ButtonGridSearch"), btn.query = !1, btn.fireEvent("click", btn))
        },
        OnReturnSuperiorClick: function() {
          var grid, record, btn;
          grid = Util.getCmp("Grid"), grid.store.getCount() && (record = grid.selModel.getLastSelected() || grid.store.getAt(0), record && (record.raw.采购单号 || record.raw.供应商编号) && (grid.上级 = !0, record.raw.采购单号 ? propertys = ["公司", "供应商编号", "总笔数", "未达成笔数"] : record.raw.供应商编号 && (propertys = ["公司", "总笔数", "未达成笔数"]), Ext.each(grid.columns, function(item, index) {
            index > 1 && (propertys.length > 0 && propertys.indexOf(item.dataIndex) == -1 ? grid.columns[index].hide() : grid.columns[index].show())
          }))), btn = Util.getCmp("ButtonGridSearch"), btn.query = !1, btn.fireEvent("click", btn)
        },
        OnGridSearchBeforeQuery: function(el) {
          el.query !== !1 && (el.query = !0)
        },
        OnBeforeParams: function() {
          var grid = Util.getCmp("Grid")
        }
      }
    }
  }
}(),
function() {
  Snmon.ThreeDaysTheArrivalOfTheGoodsForDomesticOrders = {
    Load: function() {
      this.Event.Before.Init(), ReportPage.Render(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var btnGridSearch;
        btnGridSearch = Util.getCmp("ButtonGridSearch"), delete btnGridSearch.keys.查询天数, btnGridSearch.fields.remove("查询天数")
      }
    },
    Event: {
      Before: {
        Init: function() {
          Util.OnComponent("clientbeforecomboboxexpandcreate", this.BeforeComboboxExpandCreate, this)
        },
        BeforeComboboxExpandCreate: function(o) {
          var items, i;
          if (o.ctype == "comboboxexpand")
            if (o.property == "年份") {
              for (items = [], i = Snmon.StartYear; i <= Snmon.EndYear; i++) items.push(i);
              o.store = items, o.value = Snmon.CurrentYear
            } else o.property == "月份" ? (o.store = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], o.value = Snmon.CurrentMonth) : o.property == "公司" && (o.store = ["", "1000", "1100", "1200", "1900"], o.value = "")
        }
      },
      After: {
        Init: function() {
          var grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnGridBeforeLoad, this)
        },
        OnGridBeforeLoad: function() {
          var _查询天数Cmp, _查询天数 = "",
            grid, data = {};
          _查询天数Cmp = Util.getCmp("QueryComplexFormGrid_查询天数"), _查询天数Cmp && (_查询天数 = _查询天数Cmp.getValue()), grid = Util.getCmp("Grid"), data[grid.boName] = {
            "查询天数": _查询天数
          }, grid.store.setExtraParams("filterObjectData", Ext.encode(data))
        }
      }
    }
  }
}(),
function() {
  Snmon.NavigationManage = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var treeNavigation = this.GetTreeNavigation();
        Util.AddMainPanel([treeNavigation], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "顺序保存",
          iconCls: "icon-save",
          handler: Snmon.NavigationManage.Event.Button.OnOrderSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }, {
          componentType: "button",
          id: Util.id("ButtonHelp"),
          text: "帮助",
          iconCls: "icon-help",
          handler: Util.OperateHelp
        }])
      },
      GetTreeNavigation: function() {
        var tree = Snmon.tree.Tree({
          id: "TreeNavigation",
          region: "center",
          maxWidth: 2e3,
          bodyStyle: "0px",
          boName: "导航目录",
          extraParams: {
            sign: "FindTree",
            treeBoName: "导航目录"
          },
          draggable: !0,
          sort: !1,
          rootText: Snmon.NavigationRoot.rootText,
          rootId: Snmon.NavigationRoot.rootId
        });
        tree.on("itemcontextmenu", function(view, record, item, index, e) {
          return e.stopEvent(), tree.selectPath(record.getPath()), this.GetMenu().showAt(e.getXY()), !1
        }, this);
        tree.on("containercontextmenu", function(view, e) {
          e.stopEvent(), view.panel.getRootNode().childNodes.length == 0 && this.GetMenu().showAt(e.getXY())
        }, this);
        return tree
      },
      GetMenu: function() {
        var items = [],
          add, del, modify, btnEvent = Snmon.NavigationManage.Event.Button;
        return add = Ext.create("Ext.Action", {
          iconCls: "icon-add",
          text: "添加",
          handler: btnEvent.OnAddClick,
          scope: this
        }), items.push(add), Util.getCmp("Tree_TreeNavigation").getRootNode().childNodes.length > 0 && (modify = Ext.create("Ext.Action", {
          iconCls: "icon-modify",
          text: "修改",
          handler: btnEvent.OnModifyClick,
          scope: this
        }), items.push(modify), del = Ext.create("Ext.Action", {
          iconCls: "icon-delete",
          text: "删除",
          handler: btnEvent.OnDeleteClick,
          scope: this
        }), items.push(del)), Ext.create("Ext.menu.Menu", {
          items: items
        })
      },
      WindowNavigation: function() {
        return Ext.create("Ext.window.Window", {
          id: Util.id("WindowNavigation"),
          title: "导航信息",
          height: 200,
          width: 350,
          constrainHeader: !0,
          layout: "border",
          closable: !1,
          resizable: !1,
          modal: Config.modal,
          items: this.GetFormNavigation(),
          bbar: ["->", {
            text: "保存",
            iconCls: "icon-save",
            handler: Snmon.NavigationManage.Event.Button.OnSaveClick
          }, {
            text: "取消",
            iconCls: "icon-cancel",
            handler: function() {
              Util.getCmp("WindowNavigation").hide()
            }
          }]
        })
      },
      GetFormNavigation: function() {
        return Snmon.formTable.Form({
          id: "Panel",
          region: "north",
          cols: 1,
          height: 200,
          canEditor: !0,
          config: !1,
          bodyStyle: "border:0px;margin-bottom:15px;",
          boName: "导航目录",
          items: [{
            fieldLabel: "名称",
            property: "名称",
            labelWidth: 60,
            width: 250,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "页面信息",
            labelWidth: 60,
            width: 250,
            property: "页面信息",
            propertyType: "页面信息",
            showName: "页面名称",
            dataType: "object",
            componentType: "查询控件"
          }, {
            fieldLabel: "上级",
            labelWidth: 60,
            width: 250,
            property: "上级",
            propertyType: "导航目录",
            showName: "名称",
            dataType: "object",
            componentType: "树控件",
            treeParam: Snmon.NavigationRoot
          }, {
            fieldLabel: "参数",
            property: "页面参数",
            labelWidth: 60,
            width: 250,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }]
        })
      }
    },
    Common: {
      PackageData: function() {
        var p = Util.getCmp("Panel"),
          d;
        if (d = Snmon.data.打包表单(p), d !== !1) return d && d[p.boName] ? d : !1
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {
          Util.OnComponent("clientbeforetreecreate", this.OnTreeCreate)
        },
        OnTreeCreate: function(config) {
          config.id == Util.id("Panel_上级") && (config.sort = !1)
        }
      },
      AfterEvent: {
        Init: function() {}
      },
      Button: {
        OnOrderSaveClick: function() {
          var tree = Util.getCmp("Tree_TreeNavigation"),
            d = {},
            nodes = [],
            fn;
          if (tree.store.getUpdatedRecords().length == 0) {
            Msg.Normal("没有需要保存的数据!");
            return
          }
          fn = function(node) {
            for (var childNodes = node.childNodes, data, i = 0, index = 0, ln = childNodes.length; i < ln; i++, index++) childNode = childNodes[i], data = childNode.raw || childNode.data, nodes.push({
              ID: data.id,
              "序号": index,
              "名称": data.text,
              "页面参数": data.页面参数,
              "页面信息": data.页面信息,
              "上级ID": node.get("id"),
              "版本戳": data.版本戳
            }), fn(childNode)
          }, fn(tree.store.getRootNode()), d[tree.boName] = nodes, Snmon.NavigationManage.Service.NavigationSave(d, "顺序保存")
        },
        OnSaveClick: function() {
          var d = Snmon.NavigationManage.Common.PackageData();
          d ? Snmon.NavigationManage.Service.NavigationSave(d) : d === !1 && Msg.Normal("没有数据需要保存!")
        },
        OnAddClick: function() {
          var win = Util.getCmp("WindowNavigation"),
            tree = Util.getCmp("Tree_TreeNavigation"),
            record, p, d;
          if (record = tree.selModel.getLastSelected(), !win) {
            win = this.WindowNavigation(), Util.头表树选择("Panel_上级");
            Util.getCmp("Panel_页面信息").on("clientquerybeforeload", Snmon.NavigationManage.Event.Field.On页面信息ClientQueryBeforeLoad)
          }
          win.show(), p = Util.getCmp("Panel"), p.Data = {}, d = p.Data[p.boName] = {}, record && (d.上级 = {
            ID: record.get("id"),
            "名称": record.get("text")
          }), d.名称 = "", d.页面信息 = {}, d.页面参数 = "", d[Config.OperateState] = Config.Add, d[Config.id] = Util.NewGuid(), Snmon.data.加载表单数据(p)
        },
        OnModifyClick: function() {
          var win = Util.getCmp("WindowNavigation"),
            tree = Util.getCmp("Tree_TreeNavigation"),
            p, d, record, raw, parentNode;
          if (record = tree.selModel.getLastSelected(), !record || record.isRoot()) {
            Msg.Normal("请选择...");
            return
          }
          if (!win) {
            win = this.WindowNavigation(), Util.头表树选择("Panel_上级");
            Util.getCmp("Panel_页面信息").on("clientquerybeforeload", Snmon.NavigationManage.Event.Field.On页面信息ClientQueryBeforeLoad)
          }
          win.show(), p = Util.getCmp("Panel"), p.Data = {}, d = p.Data[p.boName] = {}, record && (raw = record.raw, d[Config.OperateState] = Config.Modify, d[Config.id] = raw.id, d.名称 = raw.text, d.页面参数 = raw.页面参数, d.页面信息 = raw.页面信息, d.版本戳 = raw.版本戳, d.上级 = {}, (parentNode = record.parentNode) && !parentNode.isRoot() && (d.上级 = {
            ID: parentNode.get("id"),
            "名称": parentNode.get("text")
          })), Snmon.data.加载表单数据(p)
        },
        OnDeleteClick: function() {
          var tree = Util.getCmp("Tree_TreeNavigation"),
            record = tree.selModel.getLastSelected(),
            data = {},
            d;
          if (record && record.isRoot()) {
            Msg.Normal('无法删除"' + tree.getRootNode().get("text") + '"');
            return
          }
          Msg.Confirm("确认删除!", function(btnText) {
            btnText == "ok" && (d = data[tree.boName] = {}, d[Config.id] = record.get("id"), d[Config.OperateState] = Config.Del, Snmon.NavigationManage.Service.NavigationSave(data, "删除", "删除中,请稍等..."))
          })
        }
      },
      Field: {
        "On页面信息ClientQueryBeforeLoad": function(store) {
          !0 && store.setExtraParams("queryableToList", !0)
        }
      }
    },
    Service: {
      NavigationSave: function(data, type, msg) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: msg || "保存中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/SystemManage/NavigationManageHandler.ashx",
          method: "POST",
          params: {
            sign: "NavigationSave",
            type: type,
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            var result, win;
            mask.hide(), result = r.responseText, r.status == 200 ? result == "OK" ? type ? Msg.Normal(type == "顺序保存" ? "保存成功!" : "删除成功!", function() {
              var win = Util.getCmp("WindowNavigation");
              win && win.hide(), Util.getCmp("Tree_TreeNavigation").store.load()
            }) : (win = Util.getCmp("WindowNavigation"), win && win.hide(), Msg.Confirm("保存成功,继续添加!", function(btnText) {
              btnText == "ok" ? (win && win.show(), Snmon.NavigationManage.Event.Button.OnAddClick()) : (win && win.hide(), Util.getCmp("Tree_TreeNavigation").store.load())
            })) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.PageManage = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var buttonEvent = Snmon.PageManage.Event.Button,
          grid = this.GetPageGrid();
        Util.AddMainPanel([grid], [{
          xtype: "splitbutton",
          componentType: "splitbutton",
          id: Util.id("ButtonPageUpdate"),
          text: "页面更新",
          iconCls: "icon-save",
          menu: new Ext.menu.Menu({
            items: [{
              id: Util.id("CheckBoxDel"),
              checked: !1,
              text: "删除物理不存在的文件"
            }]
          }),
          handler: buttonEvent.OnPageUpdateClick
        }, {
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: buttonEvent.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }, {
          componentType: "button",
          id: Util.id("ButtonHelp"),
          text: "帮助",
          iconCls: "icon-help",
          handler: Util.OperateHelp
        }])
      },
      GetPageGrid: function() {
        var grid = Snmon.grid.Grid({
          id: "Grid",
          autoLoad: !0,
          paging: !0,
          addRow: !0,
          delRow: !0,
          region: "center",
          canEditor: !0,
          config: !1,
          boName: "页面信息",
          root: "data",
          extraParams: {
            sign: "PagingFind",
            boName: "页面信息",
            queryableToList: !0,
            cName: "",
            sql: "",
            dataShowWay: "管理展示"
          },
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "页面名称",
            width: 150,
            dataType: "string",
            allowBlack: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "页面地址",
            width: 500,
            dataType: "string",
            allowBlack: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "所属模块",
            width: 120,
            dataType: "string",
            componentType: "扩展控件二"
          }]
        });
        return grid.view.getRowClass = Util.列表行样式, grid
      }
    },
    Common: {
      GetCondition: function() {
        var _页面名称 = Util.getCmp("Field_页面名称").getValue().trim(),
          _页面地址 = Util.getCmp("Field_页面地址").getValue().trim(),
          _所属模块 = Util.getCmp("Field_所属模块").getValue().trim(),
          sqls = [];
        return _页面名称 && sqls.push('页面名称!=null and 页面名称.Contains("' + _页面名称 + '")'), _页面地址 && sqls.push('页面地址!=null and 页面地址.Contains("' + _页面地址 + '")'), _所属模块 && sqls.push('所属模块!=null and 所属模块.Contains("' + _所属模块 + '")'), sqls.join(" and ")
      },
      PackageData: function() {
        var grid = Util.getCmp("Grid"),
          d;
        if (d = Snmon.data.打包列表数据(grid, !1, !0), d !== !1) return d && d[grid.boName].length > 0 ? d : !1
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {
          Util.OnComponent("clientconfigtoolbar", this.OnGridConfigToolbar, this)
        },
        OnGridConfigToolbar: function(toolbar) {
          toolbar.id == Util.id("GridConfigToolbar") && toolbar.add(2, "-", "所属模块", Snmon.field.Expand2({
            id: "Field_所属模块",
            width: 100,
            dataType: "string"
          }), "页面名称", {
            id: Util.id("Field_页面名称"),
            xtype: "textfield",
            width: 100
          }, "页面地址", {
            id: Util.id("Field_页面地址"),
            xtype: "textfield",
            width: 100
          }, {
            text: "过滤",
            handler: function() {
              Util.getCmp("Grid").store.loadPage(1)
            }
          })
        }
      },
      AfterEvent: {
        Init: function() {
          this.Grid.Init(), this.Store.Init(), this.Field.Init()
        },
        Grid: {
          Init: function() {
            var me = this,
              grid = Util.getCmp("Grid");
            grid.on("select", me.OnGridSelect, me);
            grid.on("deselect", me.OnGridDeSelect, me);
            grid.on("beforeedit", me.OnGridBeforeEdit, me);
            grid.on("validateedit", me.OnGridValidateEdit, me)
          },
          OnGridSelect: function(rowModel, record) {
            var rowDel = Util.getCmp("GridDelRow"),
              raw = record.raw;
            raw && raw[Config.OperateState] == Config.Del || rowDel && rowDel.enable()
          },
          OnGridDeSelect: function() {
            var rowDel = Util.getCmp("GridDelRow");
            rowDel && rowDel.disable()
          },
          OnGridBeforeEdit: function(editor, e) {
            var raw = e.record.raw;
            if (raw && raw[Config.OperateState] == Config.Del) return !1
          },
          OnGridValidateEdit: function(editor, e) {
            var items, i;
            if (e.field == "名称")
              for (items = e.grid.store.data.items, i = items.length - 1; i >= 0; i--)
                if (items[i].data[e.field] == e.value) return !1
          }
        },
        Store: {
          Init: function() {
            this.Common = Snmon.PageManage.Common;
            var s = Util.getCmp("Grid").store;
            s.on("beforeload", this.OnGridBeforeLoad, this)
          },
          OnGridBeforeLoad: function(store) {
            store.setExtraParams("sql", this.Common.GetCondition())
          }
        },
        Field: {
          Init: function() {
            Util.getCmp("Field_所属模块").on("clientshow", function(el) {
              Snmon.window.TreeWindow({
                id: "ModelTree",
                rootText: "模块",
                extraParams: {
                  sign: "FindTree",
                  expandHandler: !0
                },
                itemdblclick: function(view, record) {
                  el.setValue(record.get("text")), Util.WindowHideOrClose(Util.getCmp("TreeWindow_ModelTree"))
                }
              })
            });
            Util.getCmp("Grid_所属模块").on("clientshow", function() {
              Snmon.window.TreeWindow({
                id: "ModelTree2",
                rootText: "模块",
                extraParams: {
                  sign: "FindTree",
                  expandHandler: !0
                },
                itemdblclick: function(view, record) {
                  var selected = Util.getCmp("Grid").selModel.getLastSelected();
                  selected && selected.set("所属模块", record.get("text")), Util.WindowHideOrClose(Util.getCmp("TreeWindow_ModelTree2"))
                }
              })
            })
          }
        }
      },
      Button: {
        OnPageUpdateClick: function() {
          Snmon.PageManage.Service.PageUpdate()
        },
        OnSaveClick: function() {
          var d = Snmon.PageManage.Common.PackageData();
          d ? Snmon.PageManage.Service.RoleSave(d) : d === !1 && Msg.Normal("没有数据需要保存!")
        }
      }
    },
    Service: {
      RoleSave: function(data) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "保存中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/SystemManage/PageManageHandler.ashx",
          method: "POST",
          params: {
            sign: "PageSave",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("保存成功!", function() {
              Util.getCmp("Grid").store.loadPage(1)
            }) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      PageUpdate: function() {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "更新中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/SystemManage/PageManageHandler.ashx",
          method: "Get",
          params: {
            sign: "PageUpdate",
            removeNotPhysics: Util.getCmp("CheckBoxDel").checked,
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("更新成功!", function() {
              Util.getCmp("Grid").store.loadPage(1)
            }) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.PageNavPower = {
    RoleId: "",
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var buttonEvent = Snmon.PageNavPower.Event.Button,
          treeRole = this.GetTreeRole(),
          grid = this.GetGrid();
        Util.AddMainPanel([treeRole, grid], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: buttonEvent.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRoleCopy"),
          text: "角色拷贝",
          iconCls: "icon-save",
          handler: buttonEvent.OnRoleCopyClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }, {
          componentType: "button",
          id: Util.id("ButtonHelp"),
          text: "帮助",
          iconCls: "icon-help",
          handler: Util.OperateHelp
        }])
      },
      GetTreeRole: function() {
        return Snmon.tree.Tree({
          id: "TreeRole",
          title: "角色",
          region: "west",
          width: 250,
          minWidth: 200,
          maxWidth: 500,
          bodyStyle: "0px",
          boName: "角色",
          split: !0,
          rootVisible: !1,
          extraParams: {
            sign: "FindTree",
            treeBoName: "角色",
            expandHandler: !0
          },
          rootText: "角色",
          itemclick: function(view, record, item, index, e) {
            e.target.nodeName != "INPUT" && (Snmon.PageNavPower.RoleId = record.get("id"), Util.getCmp("GridPageNavPower").store.load())
          }
        })
      },
      GetGrid: function() {
        Ext.define("PageNavPower", {
          extend: "Ext.data.Model",
          fields: [{
            name: "id",
            type: "string"
          }, {
            name: "text",
            type: "string"
          }, {
            name: "页面导航权限ID",
            type: "string"
          }, {
            name: "页面信息ID",
            type: "string"
          }, {
            name: "页面名称",
            type: "string"
          }, {
            name: "页面权限",
            type: "boolean"
          }, {
            name: "页面所属模块",
            type: "string"
          }, {
            name: "序号",
            type: "int"
          }, {
            name: "版本戳",
            type: "string"
          }],
          listeners: {
            clientcheckedchange: function(node, checked) {
              node.get("页面信息ID") && node.set("页面权限", checked)
            }
          }
        });
        var store = Ext.create("Ext.data.TreeStore", {
            autoLoad: !1,
            model: "PageNavPower",
            folderSort: !0,
            root: {
              text: "Root",
              id: "8c28f58c-c6f6-46b3-9679-f62ecd9c1582",
              expanded: !0
            },
            proxy: {
              type: "ajax",
              extraParams: {
                sign: "GetNode"
              },
              url: Config.VPath + "WebServices/SystemManage/PageNavPowerHandler.ashx"
            },
            listeners: {
              beforeload: function(store, options) {
                var treeRole = Util.getCmp("Tree_TreeRole"),
                  roleNode;
                return treeRole && (roleNode = treeRole.selModel.getLastFocused(), roleNode) ? (options.params.roleId = roleNode.get("id"), options.params.depth = options.node ? options.node.get("depth") : 0, !0) : !1
              }
            }
          }),
          tree = Ext.create("Ext.tree.Panel", {
            id: Util.id("GridPageNavPower"),
            title: "页面导航权限",
            region: "center",
            rootVisible: !1,
            store: store,
            viewConfig: {
              stripeRows: !0
            },
            isEditable: !0,
            multiSelect: !0,
            columns: [{
              xtype: "treecolumn",
              text: "导航名称",
              dataIndex: "text",
              menuDisabled: !0,
              sortable: !1,
              width: 350,
              renderer: function(value) {
                return value
              }
            }, {
              xtype: "checkboxcolumn",
              header: "页面权限",
              dataIndex: "页面权限",
              property: "页面权限",
              menuDisabled: !0,
              hasEditor: !0,
              width: 60,
              renderer: function(value, metaData, record) {
                return record.get("页面信息ID") ? Ext.String.format('<div class="x-grid-check-col{0}">&#160;<\/div>', value ? "-on" : "") : ""
              }
            }, {
              xtype: "gridcolumn",
              header: "页面名称",
              dataIndex: "页面名称",
              menuDisabled: !0,
              sortable: !1,
              width: 200
            }, {
              xtype: "gridcolumn",
              text: "所属模块",
              dataIndex: "页面所属模块",
              menuDisabled: !0,
              sortable: !1,
              width: 80
            }]
          });
        tree.on("beforeedit", function(editor, e) {
          if (e.field == "页面权限" && !e.record.get("页面信息ID")) return !1
        });
        tree.on("edit", function() {});
        tree.on("checkchange", Util.树节点选中改变());
        tree.on("checkchange", function(node, checked) {
          node.get("页面信息ID") && node.set("页面权限", checked)
        });
        return tree
      }
    },
    Common: {
      PackageData: function() {
        var node, innerFn, items = [],
          roleId, tree = Util.getCmp("GridPageNavPower");
        return node = tree.getRootNode(), roleId = Snmon.PageNavPower.RoleId, innerFn = function(nodes) {
          Ext.each(nodes, function(n) {
            items.push({
              ID: n.get("页面导航权限ID"),
              "角色ID": roleId,
              "导航目录ID": n.get("id"),
              "导航权限": n.get("checked"),
              "页面信息ID": n.get("页面信息ID"),
              "页面权限": n.get("页面权限"),
              "页面所属模块": n.get("页面所属模块"),
              "操作状态ID": n.get("版本戳") ? Config.Modify : Config.Add,
              "序号": n.get("序号"),
              "版本戳": n.get("版本戳")
            }), n.childNodes.length > 0 && innerFn(n.childNodes)
          })
        }, innerFn(node.childNodes), {
          "角色ID": roleId,
          "角色导航权限列表": items
        }
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {}
      },
      Button: {
        OnSaveClick: function() {
          var data = Snmon.PageNavPower.Common.PackageData();
          Snmon.PageNavPower.Service.PageNavPowerSave({
            "新角色导航页面权限": data
          })
        },
        OnRoleCopyClick: function() {
          var treeUser = Util.getCmp("Tree_TreeRole"),
            records = treeUser.getChecked();
          if (records.length == 0) return !1;
          Snmon.window.TreeWindow({
            id: "Role",
            boName: "角色",
            rootVisible: !1,
            extraParams: {
              sign: "FindTree",
              treeBoName: "角色",
              expandHandler: !0,
              noChecked: !0,
              sql: ""
            },
            beforeload: function(store) {
              var roleIds = [];
              Ext.each(treeUser.getChecked(), function(item) {
                roleIds.push("ID!='" + item.get("id") + "'")
              }), store.setExtraParams("sql", roleIds.join(" and "))
            },
            itemdblclick: function(view, record) {
              Msg.Confirm("拷贝将改变原来角色的权限,确认拷贝?", function(btn) {
                if (btn == "ok") {
                  var roleIds = [];
                  Ext.each(treeUser.getChecked(), function(item) {
                    roleIds.push(item.get("id"))
                  }), Snmon.PageNavPower.Service.PageNavPowerCopy(roleIds.join(","), record.get("id"))
                }
              })
            }
          })
        },
        OnHelpClick: function() {}
      }
    },
    Service: {
      PageNavPowerSave: function(data) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "保存中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/SystemManage/PageNavPowerHandler.ashx",
          method: "POST",
          params: {
            sign: "SavePageNavPower",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? (Msg.Normal("保存成功!"), Util.getCmp("GridPageNavPower").store.load()) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      PageNavPowerCopy: function(roleIds, copyRoleId) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "处理中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/SystemManage/PageNavPowerHandler.ashx",
          method: "POST",
          params: {
            sign: "PagePowerCopy",
            roleId: roleIds,
            copyRoleId: copyRoleId,
            page: Util.getPageName()
          },
          success: function(r) {
            var result, win;
            mask.hide(), result = r.responseText, r.status == 200 && result == "OK" ? (win = Util.getCmp("TreeWindow_Role"), win && win.hide(), Msg.Normal("完成拷贝!")) : Msg.Question(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.RoleManage = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var grid = this.GetRoleGrid();
        Util.AddMainPanel([grid], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: Snmon.RoleManage.Event.Button.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }, {
          componentType: "button",
          id: Util.id("ButtonHelp"),
          text: "帮助",
          iconCls: "icon-help",
          handler: Util.OperateHelp
        }])
      },
      GetRoleGrid: function() {
        var grid = Snmon.grid.Grid({
          id: "Grid",
          autoLoad: !0,
          region: "center",
          canEditor: !0,
          config: !1,
          boName: "角色",
          extraParams: {
            sign: "Find",
            boName: "角色",
            cName: "",
            sql: "",
            queryableToList: !0,
            dataShowWay: "管理展示"
          },
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "名称",
            width: 200,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }]
        });
        return grid.view.getRowClass = Util.列表行样式, grid
      }
    },
    Common: {
      PackageData: function() {
        var g = Util.getCmp("Grid"),
          d;
        if (d = Snmon.data.打包列表数据(g, !1, !0), d !== !1) return d && d[g.boName].length > 0 ? d : !1
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {
          var me = this,
            grid = Util.getCmp("Grid");
          grid.on("select", me.OnGridSelect, me);
          grid.on("deselect", me.OnGridDeSelect, me);
          grid.on("beforeedit", me.OnGridBeforeEdit, me);
          grid.on("validateedit", me.OnGridValidateEdit, me)
        },
        OnGridSelect: function(rowModel, record) {
          var rowDel = Util.getCmp("GridDelRow"),
            raw = record.raw;
          raw && raw[Config.OperateState] == Config.Del || rowDel && rowDel.enable()
        },
        OnGridDeSelect: function() {
          var rowDel = Util.getCmp("GridDelRow");
          rowDel && rowDel.disable()
        },
        OnGridBeforeEdit: function(editor, e) {
          var raw = e.record.raw;
          if (raw && raw[Config.OperateState] == Config.Del) return !1
        },
        OnGridValidateEdit: function(editor, e) {
          var items, i;
          if (e.field == "角色名称")
            for (items = e.grid.store.data.items, i = items.length - 1; i >= 0; i--)
              if (items[i].data[e.field] == e.value) return !1
        }
      },
      Button: {
        OnSaveClick: function() {
          var d = Snmon.RoleManage.Common.PackageData();
          d ? Snmon.RoleManage.Service.RoleSave(d) : d === !1 && Msg.Normal("没有数据需要保存!")
        }
      }
    },
    Service: {
      RoleSave: function(data) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "保存中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/SystemManage/RoleManageHandler.ashx",
          method: "POST",
          params: {
            sign: "RoleSave",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("保存成功!", function() {
              Util.getCmp("Grid").store.load()
            }) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.SystemInitialization = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var panel = this.Panel();
        Util.AddMainPanel([panel], [{
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }])
      },
      Panel: function() {
        return {
          xtype: "panel",
          region: "center",
          bodyPadding: 5,
          layout: {
            type: "table",
            columns: 2
          },
          defaults: {
            border: !1,
            margin: "5 5 5 5"
          },
          items: [{
            xtype: "button",
            text: "清空数据库",
            handler: function() {
              Msg.Confirm("确认清空数据库?", function(btn) {
                btn == "ok" && Snmon.SystemInitialization.Service.Initialization(1)
              })
            }
          }, {
            xtype: "label",
            html: '<div style="color:red;">完全清空数据库<\/div>'
          }, {
            xtype: "button",
            text: "除指定表之外清空数据库",
            handler: function() {
              Msg.Confirm("确认清空数据库?", function(btn) {
                btn == "ok" && Snmon.SystemInitialization.Service.Initialization(2)
              })
            }
          }, {
            xtype: "label",
            html: '<div style="color:red;">除指定功能（编号设置，角色导航权限，业务对象信息，业务对象权限，页面信息）之外清空数据库,<br/>同时创建系统管理员角色和admin账号<\/div>'
          }, {
            xtype: "button",
            text: "保留业务基础信息的清空关系",
            handler: function() {
              Msg.Confirm("确认清空数据库?", function(btn) {
                btn == "ok" && Snmon.SystemInitialization.Service.Initialization(3)
              })
            }
          }, {
            xtype: "label",
            html: '<div style="color:red;">保留业务基础信息的清空关系<\/div>'
          }, {
            xtype: "button",
            text: "系统勾稽科目初始化",
            handler: function() {
              Msg.Confirm("确认初始化?", function(btn) {
                btn == "ok" && Snmon.SystemInitialization.Service.Initialization(4)
              })
            }
          }, {
            xtype: "label",
            html: '<div style="color:red;">初始化的科目无法删除！<\/div>'
          }]
        }
      }
    },
    Common: {},
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {}
      }
    },
    Service: {
      Initialization: function(sign) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "处理中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          timeout: Config.timeout,
          method: "POST",
          url: Config.VPath + "WebServices/SystemManage/SystemInitializationHandler.ashx",
          params: {
            sign: sign
          },
          success: function(r) {
            mask.hide(), r.responseText == "OK" ? Msg.Normal("处理完成") : Msg.Normal(r.responseText)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          }
        })
      }
    }
  }
}(),
function() {
  Snmon.UserRoleManage = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var buttonEvent = Snmon.UserRoleManage.Event.Button,
          treeUser = this.GetTreeUser(),
          treeRole = this.GetTreeRole();
        Util.AddMainPanel([treeUser, treeRole], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: buttonEvent.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }, {
          componentType: "button",
          id: Util.id("ButtonHelp"),
          text: "帮助",
          iconCls: "icon-help",
          handler: Util.OperateHelp
        }])
      },
      GetTreeUser: function() {
        var tree = Snmon.tree.Tree({
          id: "TreeUser",
          region: "west",
          width: 300,
          maxWidth: 200,
          maxWidth: 500,
          bodyStyle: "0px",
          boName: "用户",
          extraParams: {
            sign: "FindTree",
            treeBoName: "用户",
            expandHandler: !0
          },
          rootText: "用户",
          itemclick: function() {
            var treeRole = Util.getCmp("Tree_TreeRole");
            treeRole.store.load()
          }
        });
        tree.on("itemcontextmenu", function(view, record, item, index, e) {
          return e.stopEvent(), tree.selectPath(record.getPath()), this.GetUserMenu().showAt(e.getXY()), !1
        }, this);
        return tree
      },
      GetTreeRole: function() {
        return Snmon.tree.Tree({
          id: "TreeRole",
          region: "center",
          maxWidth: 2e3,
          bodyStyle: "0px",
          boName: "角色",
          extraParams: {
            sign: "FindTree",
            treeBoName: "角色",
            expandHandler: !0
          },
          rootText: "角色",
          beforeload: function(store) {
            var treeUser = Util.getCmp("Tree_TreeUser"),
              record = treeUser.selModel.getLastSelected();
            if (!record) return !1;
            store.setExtraParams("sql", record.get("id"))
          }
        })
      },
      GetUserMenu: function() {
        var add, del, modify, btnEvent = Snmon.UserRoleManage.Event.Button;
        return add = Ext.create("Ext.Action", {
          iconCls: "icon-add",
          text: "添加",
          handler: btnEvent.OnAddClick,
          scope: this
        }), modify = Ext.create("Ext.Action", {
          iconCls: "icon-modify",
          text: "修改",
          handler: btnEvent.OnModifyClick,
          scope: this
        }), del = Ext.create("Ext.Action", {
          iconCls: "icon-delete",
          text: "删除",
          handler: btnEvent.OnDeleteClick,
          scope: this
        }), Ext.create("Ext.menu.Menu", {
          items: [add, modify, del]
        })
      },
      WindowUser: function() {
        return Ext.create("Ext.window.Window", {
          id: Util.id("WindowUser"),
          title: "用户信息",
          height: 400,
          width: 350,
          constrainHeader: !0,
          layout: "border",
          closable: !1,
          resizable: !1,
          modal: Config.modal,
          items: this.GetFormUser(),
          bbar: ["->", {
            text: "保存",
            iconCls: "icon-save",
            handler: Snmon.UserRoleManage.Event.Button.OnSaveUserClick
          }, {
            text: "取消",
            iconCls: "icon-cancel",
            handler: function() {
              Util.getCmp("WindowUser").hide()
            }
          }]
        })
      },
      GetFormUser: function() {
        return Snmon.formTable.Form({
          id: "Panel",
          region: "north",
          cols: 1,
          height: 400,
          canEditor: !0,
          config: !1,
          bodyStyle: "border:0px;margin-bottom:15px;",
          boName: "用户",
          items: [{
            fieldLabel: "用户名",
            labelWidth: 80,
            width: 200,
            allowBlank: !1,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "密码",
            labelWidth: 80,
            width: 200,
            inputType: "password",
            allowBlank: !1,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "确认密码",
            labelWidth: 80,
            width: 200,
            inputType: "password",
            vtype: "repetition",
            repetition: {
              targetId: "Panel_密码"
            },
            allowBlank: !1,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "电话号码",
            labelWidth: 80,
            width: 200,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "所属公司",
            labelWidth: 80,
            width: 200,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "所属部门",
            labelWidth: 80,
            width: 200,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "职位",
            labelWidth: 80,
            width: 200,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "员工",
            labelWidth: 80,
            width: 200,
            dataType: "object",
            componentType: "查询控件",
            property: "用户",
            propertyType: "员工",
            showName: "员工名称"
          }, {
            fieldLabel: "总报表用户名",
            labelWidth: 80,
            width: 200,
            readOnly: !1,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "是否启用",
            labelWidth: 80,
            width: 200,
            dataType: "boolean",
            componentType: "复选控件"
          }]
        })
      }
    },
    Common: {
      PackageUserData: function() {
        var p = Util.getCmp("Panel"),
          d, data;
        if (d = Snmon.data.打包表单(p), d !== !1) {
          if (d && (data = d[p.boName])) {
            if (data[Config.OperateState] == Config.Modify) {
              if (!(data.密码 == data.确认密码 && data.密码 == "******")) return !1;
              delete data.密码, delete data.确认密码
            }
            return d
          }
          return !1
        }
      },
      PackageUserRoleData: function() {
        var treeUser = Util.getCmp("Tree_TreeUser"),
          treeRole = Util.getCmp("Tree_TreeRole"),
          record = treeUser.selModel.getLastSelected(),
          d = {},
          roles = [],
          roleRecords, data, i;
        if (!record || record.isRoot()) {
          Msg.Normal("请选择...");
          return
        }
        for (roleRecords = treeRole.getChecked(), i = roleRecords.length - 1; i >= 0; i--) roles.push({
          ID: Util.NewGuid(),
          "角色ID": roleRecords[i].get("id")
        });
        return data = Ext.clone(record.raw), Ext.apply(data, {
          "用户角色列表": roles,
          ID: data.id,
          "用户名": data.text,
          "操作状态ID": Config.Modify
        }), data.密码 = "", delete data.id, delete data.text, delete data.leaf, d[treeUser.boName] = data, d
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {
          var me = this
        }
      },
      Button: {
        OnSaveClick: function() {
          var d = Snmon.UserRoleManage.Common.PackageUserRoleData();
          d ? Snmon.UserRoleManage.Service.UserSave(d) : d === !1 && Msg.Normal("没有数据需要保存!")
        },
        OnSaveUserClick: function() {
          var d = Snmon.UserRoleManage.Common.PackageUserData();
          d ? Snmon.UserRoleManage.Service.UserSave(d, "用户保存") : d === !1 && Msg.Normal("没有数据需要保存!")
        },
        OnHelpClick: function() {},
        OnAddClick: function() {
          var win = Util.getCmp("WindowUser"),
            p, d;
          win || (win = this.WindowUser()), win.show(), p = Util.getCmp("Panel"), p.Data = {}, d = p.Data[p.boName] = {}, d[Config.id] = Util.NewGuid(), d[Config.OperateState] = Config.Add, d.用户名 = "", d.密码 = "", d.确认密码 = "", Snmon.data.加载表单数据(p)
        },
        OnModifyClick: function() {
          var win = Util.getCmp("WindowUser"),
            tree = Util.getCmp("Tree_TreeUser"),
            p, d, record, raw;
          if (record = tree.selModel.getLastSelected(), !record || record.isRoot()) {
            Msg.Normal("请选择...");
            return
          }
          win || (win = this.WindowUser()), win.show(), p = Util.getCmp("Panel"), p.Data = {}, d = p.Data[p.boName] = {}, record && (raw = record.raw, d[Config.id] = raw.id, d[Config.OperateState] = Config.Modify, d.用户名 = raw.text, d.密码 = "******", d.确认密码 = "******", d.电话号码 = raw.电话号码, d.所属公司 = raw.所属公司, d.所属部门 = raw.所属部门, d.职位 = raw.职位, d.是否启用 = raw.是否启用, d.总报表用户名 = raw.总报表用户名, d.员工 = raw.员工, d.版本戳 = raw.版本戳), Snmon.data.加载表单数据(p)
        },
        OnDeleteClick: function() {
          var tree = Util.getCmp("Tree_TreeUser"),
            record = tree.selModel.getLastSelected(),
            data = {},
            d;
          if (record && record.isRoot()) {
            Msg.Normal('无法删除"' + tree.getRootNode().get("text") + '"');
            return
          }
          Msg.Confirm("确认删除!", function(btnText) {
            btnText == "ok" && (d = data[tree.boName] = {}, d[Config.id] = record.get("id"), d[Config.OperateState] = Config.Del, Snmon.UserRoleManage.Service.UserSave(data, "删除", "删除中,请稍等..."))
          })
        }
      }
    },
    Service: {
      UserSave: function(data, type, msg) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: msg || "保存中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/SystemManage/UserRoleManageHandler.ashx",
          method: "POST",
          params: {
            sign: "UserSave",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? type && type != "删除" ? Msg.Confirm("保存成功,继续添加!", function(btnText) {
              if (btnText == "ok") Snmon.UserRoleManage.Event.Button.OnAddClick();
              else {
                var win = Util.getCmp("WindowUser");
                win && win.hide(), Util.getCmp("Tree_TreeUser").store.load()
              }
            }) : type == "删除" ? Msg.Normal("删除成功!", function() {
              var win = Util.getCmp("WindowUser");
              win && win.hide(), Util.getCmp("Tree_TreeUser").store.load()
            }) : Util.getCmp("Tree_TreeUser").store.load() : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.AccountCreatList = {
    Load: function() {
      this.Event.BeforeEvent.Init(), ListPage.Render({
        items: "SystemViews/AccountCreatEdit.aspx",
        ShowQuery: !1,
        autoload: !0
      }), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      BeforeEvent: {
        Init: function() {
          Util.OnComponent("clientbeforetextcreate", function(o) {
            o.property == "密码" && (o.inputType = "password")
          }), Util.OnComponent("clientlistedit", function() {
            var btnSubmit = Util.getCmp("ButtonSubmit");
            btnSubmit.on("clientbeforeclick", function(btn, d) {
              if (d.用户.用户角色列表.length == 0) return Msg.Normal("请选择角色"), !1
            })
          }), Util.OnComponent("clientlistedit", function() {
            var _用户名Cmp = Util.getPanelCmp("用户名"),
              _员工Cmp;
            _用户名Cmp && _用户名Cmp.setDisabled(!1), _员工Cmp = Util.getPanelCmp("员工"), _员工Cmp && _员工Cmp.on("clientvalue", function(el, records) {
              var record = records[0],
                con = Util.getPanelCmp("用户名");
              con && con.setValue(record.data.编号)
            })
          })
        }
      },
      AfterEvent: {
        Init: function() {
          var grid = Util.getCmp("Grid");
          grid.store.on("beforeload", this.OnBeforeLoadGrid);
          grid.store.loadPage(1)
        },
        OnBeforeLoadGrid: function() {}
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.DefaultOperationPowerInstall = {
    GridIds: [],
    PanelData: null,
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var treeOperation, formPower, gridToolbarPower, gridMethodPower, panel, treeDepartment, gridUser, gridRole, buttons = [],
          methods = [];
        treeOperation = this.GetTreeOperation(), formPower = this.GetFormPower(), gridToolbarPower = this.GetGridToolbarPower(), gridMethodPower = this.GetGridMethodPower(), treeDepartment = this.GetTreeDepartment(), treeDepartment.flex = 1, gridUser = this.GetGridUser(), gridUser.flex = 1, gridRole = this.GetGridRole(), gridRole.flex = 1, Ext.each(Snmon.Buttons || [], function(item) {
          buttons.push({
            id: Util.id("Button_" + item),
            xtype: "combobox",
            fieldLabel: item,
            labelWidth: 35,
            width: 90,
            labelSeparator: "",
            editable: !1,
            value: Snmon.ToolbarPower[1],
            store: Snmon.ToolbarPower
          })
        }), Ext.each(Snmon.Methods || [], function(item) {
          methods.push({
            id: Util.id("Method_" + item),
            xtype: "combobox",
            fieldLabel: item,
            labelWidth: 35,
            width: 90,
            labelSeparator: "",
            editable: !1,
            value: Snmon.ToolbarPower[1],
            store: Snmon.ToolbarPower
          })
        }), panel = Ext.create("Ext.Panel", {
          title: "基础权限",
          bodyStyle: "border:0px;",
          layout: {
            type: "vbox",
            align: "stretch"
          },
          items: [formPower, treeDepartment, gridUser, gridRole]
        }), Util.AddMainPanel([treeOperation, {
          region: "center",
          layout: "border",
          bodyStyle: "border:0px;",
          items: [{
            id: Util.id("TabForm"),
            xtype: "tabpanel",
            region: "center",
            bodyStyle: "border-top:0px;",
            items: [panel, gridToolbarPower, gridMethodPower]
          }]
        }], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: Snmon.DefaultOperationPowerInstall.Event.Button.OnSaveClick
        }, {
          xtype: "splitbutton",
          componentType: "button",
          id: Util.id("ButtonAdd"),
          text: "更新默认权限",
          iconCls: "icon-refresh",
          menu: {
            items: [{
              id: Util.id("DefaultListDataPower"),
              xtype: "combobox",
              fieldLabel: "列表数据权限",
              labelWidth: 85,
              width: 200,
              labelSeparator: "",
              editable: !1,
              value: "查看所有操作员",
              store: Snmon.ListDataPower
            }, {
              text: "按钮权限",
              menu: {
                items: buttons
              }
            }, {
              text: "方法权限",
              menu: {
                items: methods
              }
            }]
          },
          handler: Snmon.DefaultOperationPowerInstall.Event.Button.OnUpdatePower
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }]);
        treeOperation.on("checkchange", Util.树节点选中改变())
      },
      GetTreeOperation: function() {
        return Snmon.tree.Tree({
          id: "TreeOperation",
          region: "west",
          title: "业务信息",
          rootVisible: !1,
          width: 250,
          bodyStyle: "0px",
          boName: "业务对象信息",
          extraParams: {
            sign: "FindTree",
            treeBoName: "业务对象信息",
            expandHandler: !0,
            noLeafChecked: !1
          },
          rootText: "业务对象",
          itemclick: Snmon.DefaultOperationPowerInstall.Event.Tree.OnNodeItemClick
        })
      },
      GetFormPower: function() {
        return Ext.create("Ext.form.Panel", {
          xtype: "form",
          id: Util.id("FormPower"),
          bodyPadding: 5,
          title: "",
          layout: {
            type: "table",
            columns: 1
          },
          items: [{
            id: Util.id("Panel_数据控制规则字符"),
            fieldLabel: "数据控制规则字符",
            xtype: "triggerfield",
            labelAlign: "right",
            labelSeparator: "",
            ctype: "expand",
            editable: !1,
            width: 450,
            trigger1Cls: "x-form-clear-trigger",
            trigger2Cls: "x-form-elp-trigger",
            listeners: {
              triggerclick: Snmon.DefaultOperationPowerInstall.Event.AfterEvent.OnConditionForm
            }
          }, {
            id: Util.id("Panel_列表数据权限"),
            fieldLabel: "列表数据权限",
            xtype: "combo",
            labelSeparator: "",
            editable: !1,
            queryMode: "local",
            store: Snmon.ListDataPower,
            value: Snmon.ListDataPower && Snmon.ListDataPower[0],
            listeners: {
              change: function(field, newValue) {
                newValue == "移除" && field.setValue("")
              }
            }
          }]
        })
      },
      GetTreeDepartment: function() {
        return Snmon.tree.Tree({
          id: "Department",
          title: "组织架构",
          maxWidth: 5e3,
          width: null,
          rootVisible: !1,
          bodyStyle: "0px",
          boName: "组织架构",
          autoLoad: !1,
          extraParams: {
            sign: "FindTree",
            treeBoName: "组织架构",
            expandHandler: !0
          },
          rootText: "组织架构",
          rootId: "333334AD-2242-4481-9CA3-6CABEC5E6790",
          beforeload: function(store) {
            var treeOperation, operationRecord, _列表数据权限Cmp, _列表数据权限;
            if (treeOperation = Util.getCmp("Tree_TreeOperation"), _列表数据权限Cmp = Util.getCmp("Panel_列表数据权限"), _列表数据权限 = _列表数据权限Cmp.getValue(), operationRecord = treeOperation.selModel.getLastFocused(), !operationRecord || _列表数据权限 != "明细配置") return store.getRootNode().childNodes.length == 0 ? !1 : !0;
            store.setExtraParams("typeName", operationRecord.raw.业务名称)
          }
        })
      },
      GetGridToolbarPower: function() {
        return Snmon.grid.Grid({
          id: "GridToolbarPower",
          title: "按钮权限",
          config: !1,
          addRow: !1,
          delRow: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象工具栏权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "按钮名称",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "按钮权限状态",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            store: Snmon.ToolbarPower,
            componentType: "下拉扩展控件"
          }]
        })
      },
      GetGridMethodPower: function() {
        return Snmon.grid.Grid({
          id: "GridMethodPower",
          title: "方法权限",
          config: !1,
          addRow: !1,
          delRow: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象列表方法权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "方法名称",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "方法权限状态",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            store: Snmon.ToolbarPower,
            componentType: "下拉扩展控件"
          }]
        })
      },
      GetGridUser: function() {
        return Snmon.grid.Grid({
          id: "GridUser",
          title: "用户",
          config: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象用户权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "用户",
            property: "用户",
            width: 120,
            dataType: "object",
            allowBlank: !1,
            showName: "名称",
            propertyType: "员工",
            componentType: "查询控件"
          }]
        })
      },
      GetGridRole: function() {
        return Snmon.grid.Grid({
          id: "GridRole",
          title: "角色",
          config: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象角色权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "角色",
            property: "角色",
            width: 120,
            dataType: "object",
            allowBlank: !1,
            showName: "名称",
            propertyType: "角色",
            componentType: "查询控件"
          }]
        })
      }
    },
    Common: {
      GetGridPropertyPower: function(boName, title) {
        return Snmon.grid.Grid({
          id: "Grid" + boName,
          title: title || boName + "属性权限",
          config: !1,
          addRow: !1,
          delRow: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象属性权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性类型",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性名称",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "属性权限",
            property: "属性权限状态",
            width: 65,
            dataType: "string",
            allowBlank: !1,
            store: Snmon.PropertyPower,
            componentType: "下拉扩展控件"
          }, {
            fieldLabel: "属性类型",
            width: 100,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件"
          }, {
            fieldLabel: "属性默认值",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件"
          }, {
            fieldLabel: "数据控制规则字符",
            width: 200,
            dataType: "string",
            allowBlank: !0,
            componentType: "扩展控件"
          }, {
            fieldLabel: "数据控制规则结构存储",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "数据控制关联查询字符",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性类型显示属性",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "数据类型",
            dataType: "string",
            configType: "展示隐藏"
          }]
        })
      },
      "打包列表数据": function(grid, headId, datas, boName) {
        var items, data, item, i, ln;
        if (!grid) return !1;
        for (items = grid.store.data.items, i = 0, ln = items.length; i < ln; i++) {
          if (item = items[i], Snmon.data.列表行数据验证和提示(item, i) === !1) return !1;
          data = Ext.apply(item.raw || {}, item.data), data.分组名 = boName, data[Config.headId] = headId, data[Config.OperateState] = !data[Config.OperateState] || data[Config.OperateState] == Config.EmptyGuid ? Config.Add : Config.Modify, datas.push(data)
        }
      },
      PackageData: function() {
        var data = Snmon.DefaultOperationPowerInstall.PanelData,
          items = Snmon.DefaultOperationPowerInstall.GridIds,
          propertyData = [],
          toolbarData = [],
          methodData = [],
          userData = [],
          departmentData = [],
          roleData = [],
          flag, treeDepartment, departmentRecords, _数据控制规则字符Cmp, i, len;
        if (!data || (_数据控制规则字符Cmp = Util.getPanelCmp("数据控制规则字符"), d = data.业务对象权限, d.列表数据权限 = Util.getPanelCmp("列表数据权限").getValue(), d.数据控制规则字符 = _数据控制规则字符Cmp.clientsql, d.数据控制规则结构存储 = _数据控制规则字符Cmp.clientdata, d.数据控制关联查询字符 = _数据控制规则字符Cmp.clientinclude, d[Config.OperateState] = d[Config.OperateState] == Config.EmptyGuid ? Config.Add : Config.Modify, flag = this.打包列表数据(Util.getCmp("GridToolbarPower"), d[Config.id], toolbarData), flag === !1) || (flag = this.打包列表数据(Util.getCmp("GridMethodPower"), d[Config.id], methodData), flag === !1) || (flag = this.打包列表数据(Util.getCmp("GridUser"), d[Config.id], userData), flag === !1) || (flag = this.打包列表数据(Util.getCmp("GridRole"), d[Config.id], roleData), flag === !1)) return !1;
        for (i = 0, len = items.length; i < len; i++)
          if (flag = this.打包列表数据(Util.getCmp(items[i]), d[Config.id], propertyData, items[i].replace("Grid", "")), flag === !1) return !1;
        return treeDepartment = Util.getCmp("Tree_Department"), departmentRecords = treeDepartment.getChecked(), Ext.each(departmentRecords, function(item) {
          departmentData.push({
            ID: Util.NewGuid(),
            "头表ID": d[Config.id],
            "部门ID": item.get("id"),
            "操作状态ID": Config.Add
          })
        }), d.业务对象属性权限列表 = propertyData, d.业务对象工具栏权限列表 = toolbarData, d.业务对象列表方法权限列表 = methodData, d.可查看用户明细列表 = userData, d.可查看角色明细列表 = roleData, d.可查看部门明细列表 = departmentData, data
      },
      "数据加载": function(data) {
        var items, tab, id, boName, _列表数据权限Cmp, _数据控制规则字符Cmp, _业务对象权限, treeDepartment;
        this.移除列表控件(), items = [], tab = Util.getCmp("TabForm");
        for (id in data)
          if (["Panel", "GridToolbarPower", "GridMethodPower", "GridUser", "GridRole"].indexOf(id) == -1) {
            items.push(id), boName = id.replace("Grid", ""), grid = this.GetGridPropertyPower(boName, boName), tab.add(grid);
            grid.on("beforeedit", Snmon.DefaultOperationPowerInstall.Event.AfterEvent.Grid.OnGridBeforeEdit, Snmon.DefaultOperationPowerInstall.Event.AfterEvent.Grid);
            grid.on("edit", Snmon.DefaultOperationPowerInstall.Event.AfterEvent.Grid.OnGridEdit);
            if (_数据控制规则字符Cmp = Util.getCmp(id + "_数据控制规则字符"), _数据控制规则字符Cmp) {
              _数据控制规则字符Cmp.on("clientshow", Snmon.DefaultOperationPowerInstall.Event.AfterEvent.OnCondition);
              _数据控制规则字符Cmp.on("clientclear", function() {
                grid.selModel.getLastSelected().set("数据控制规则字符", "")
              })
            }
            grid.store.loadRawData(data[id])
          } else id == "Panel" ? (Snmon.DefaultOperationPowerInstall.PanelData = data[id], _业务对象权限 = data[id].业务对象权限, _列表数据权限Cmp = Util.getPanelCmp("列表数据权限"), _列表数据权限Cmp.setValue(_业务对象权限.列表数据权限), _数据控制规则字符Cmp = Util.getPanelCmp("数据控制规则字符"), _数据控制规则字符Cmp.clientdata = _业务对象权限.数据控制规则结构存储, _数据控制规则字符Cmp.clientsql = _业务对象权限.数据控制规则字符, _数据控制规则字符Cmp.clientinclude = _业务对象权限.数据控制关联查询字符, _数据控制规则字符Cmp.setValue(Ext.htmlDecode(_业务对象权限.数据控制规则字符)), treeDepartment = Util.getCmp("Tree_Department"), _业务对象权限.列表数据权限 == "明细配置" ? treeDepartment.store.load() : (treeDepartment.store.setExtraParams("roleId", ""), treeDepartment.store.load())) : Util.getCmp(id).store.loadRawData(data[id]);
        Snmon.DefaultOperationPowerInstall.GridIds = items
      },
      "移除列表控件": function() {
        for (var items = Snmon.DefaultOperationPowerInstall.GridIds, tab = Util.getCmp("TabForm"), i = 0, len = items.length; i < len; i++) tab.remove(Util.getCmp(items[i]))
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {
          this.Grid.Init();
          var _列表数据权限Cmp, gridUser, gridRole, _用户Cmp;
          _列表数据权限Cmp = Util.getCmp("Panel_列表数据权限");
          _列表数据权限Cmp.on("select", this.On列表数据权限Select, this);
          gridUser = Util.getCmp("GridUser");
          gridUser.on("select", this.OnGridUserSelect, this);
          gridUser.on("deselect", this.OnGridUserSelect, this);
          gridUser.store.on("clientbeforeaddrow", this.OnGridUserStoreAdd, this);
          gridRole = Util.getCmp("GridRole");
          gridRole.on("select", this.OnGridRoleSelect, this);
          gridRole.on("deselect", this.OnGridRoleSelect, this);
          gridRole.store.on("clientbeforeaddrow", this.OnGridRoleStoreAdd, this);
          _用户Cmp = Util.getCmp("GridUser_用户"), _用户Cmp.events.clientfilteralreadyselect = !0
        },
        "On列表数据权限Select": function(combo) {
          var _列表数据权限, treeDepartment;
          treeDepartment = Util.getCmp("Tree_Department"), _列表数据权限 = combo.getValue(), _列表数据权限 != "明细配置" && treeDepartment.store.setExtraParams("roleId", ""), treeDepartment.selModel.lastSelected = null, treeDepartment.store.load()
        },
        OnGridUserSelect: function(rowModel) {
          var records, delRow;
          delRow = Util.getCmp("GridUserDelRow"), records = rowModel.getSelection(), records.length > 0 ? delRow.enable() : delRow.disable()
        },
        OnGridUserStoreAdd: function() {
          var treeOperation, operationRecord;
          return treeOperation = Util.getCmp("Tree_TreeOperation"), operationRecord = treeOperation.selModel.getLastFocused(), operationRecord ? void 0 : !1
        },
        OnGridRoleSelect: function(rowModel) {
          var records, delRow;
          delRow = Util.getCmp("GridRoleDelRow"), records = rowModel.getSelection(), records.length > 0 ? delRow.enable() : delRow.disable()
        },
        OnGridRoleStoreAdd: function() {
          var treeOperation, operationRecord;
          return treeOperation = Util.getCmp("Tree_TreeOperation"), operationRecord = treeOperation.selModel.getLastFocused(), operationRecord ? void 0 : !1
        },
        Grid: {
          Init: function() {
            Util.getCmp("GridToolbarPower").on("beforeedit", this.OnGridBeforeEdit, this)
          },
          OnGridBeforeEdit: function(editor, e) {
            var field, record, items;
            if (field = e.field, record = e.record, ["属性名称", "按钮名称", "方法名称", "属性类型"].indexOf(field) != -1) return !1;
            if (["权限控制属性", "数据权限"].indexOf(field) != -1) {
              if (field == "数据权限" && record.raw.是否区域部门) return !0;
              if (record.get("属性类型") && (field != "数据权限" || record.get("权限控制属性")) && (field != "权限控制属性" || !record.raw.是否区域部门)) items = [], Ext.each(Ext.decode(record.raw.待控制属性集合), function(item) {
                items.push({
                  id: item,
                  field1: item
                })
              }), Util.getCmp(e.grid.id + "_权限控制属性").store.loadData(items);
              else return !1
            } else if (field == "数据控制规则字符") return record.raw.属性类型 ? !0 : !1;
            this.默认值的编辑(editor, e)
          },
          OnGridEdit: function(editor, e) {
            var field, record;
            field = e.field, record = e.record, field == "权限控制属性" && !record.get("数据权限") && e.value ? record.set("数据权限", "查看所有级别") : e.value || field != "权限控制属性" || record.set("数据权限", "")
          },
          "默认值的编辑": function(editor, e) {
            if (e.field == "属性默认值") {
              var record = e.record,
                dtype = record.get("数据类型"),
                field;
              switch (dtype) {
                case "int":
                case "float":
                  field = Snmon.field.Number({
                    hideLabel: !1
                  });
                  break;
                case "object":
                  field = Ext.form.field.Trigger({
                    id: Util.id("Query_" + record.get("属性名称").replace(/\./g, "_")),
                    xtype: "triggerfield",
                    trigger1Cls: "x-form-clear-trigger",
                    trigger2Cls: "x-form-elp-trigger",
                    hideLabel: !1,
                    editable: !0,
                    listeners: {
                      triggerclick: function(el, trigger, index) {
                        if (index == 0) el.setValue("");
                        else {
                          el.propertyType = record.get("属性类型");
                          var config = {
                            id: el.id,
                            boName: el.propertyType,
                            component: el,
                            multiSelect: dtype == "array",
                            rowdblselect: function() {
                              var selModel = config[Util.id(config.gridId)].selModel,
                                records = selModel.getSelection(),
                                lastRecords = selModel.getLastSelected(),
                                ds = [],
                                d, recordItem, showProperty = record.get("属性类型显示属性") || Config.id,
                                i, ln;
                              if (lastRecords && records.indexOf(lastRecords) == -1 && records.push(lastRecords), records.length == 0) {
                                Msg.Normal("请选择..");
                                return
                              }
                              for (i = 0, ln = records.length; i < ln; i++) recordItem = records[i], d = {}, d[Config.id] = recordItem.get(Config.id), d[showProperty] = recordItem.get(showProperty) || "", ds.push(d);
                              config.multiSelect ? record.set("属性默认值", Ext.encode(ds).replace(/"/g, "'")) : record.set("属性默认值", Ext.encode(ds[0]).replace(/"/g, "'")), Util.WindowHideOrClose(config.win, config)
                            },
                            select: function() {
                              config[Util.id(config.gridId)].fireEvent("itemdblclick")
                            }
                          };
                          config.win = Snmon.query.Query(config), Ext.isEmptyObject(config.win.config) && (config.win.config = config), config.win.config[Util.id(config.win.config.gridId)].store.loadPage(1)
                        }
                      }
                    }
                  });
                  break;
                default:
                  field = Snmon.field.Text({
                    hideLabel: !1
                  })
              }
              e.column.setEditor(field)
            }
          }
        },
        OnCondition: function(el) {
          var win, record, grid;
          win = Util.getCmp("WindowCondition"), win || (win = Ext.create("Snmon.query.WindowCondition", {
            listeners: {
              confirm: function(win, grid) {
                var record = Util.getCmp(win.gridId).selModel.getLastSelected();
                record.set("数据控制规则字符", grid.GetSql()), record.set("数据控制规则结构存储", escape(Ext.encode(grid.GetItems()))), record.set("数据控制关联查询字符", grid.GetIncludeField()), record = null
              }
            }
          })), grid = Util.getCmp(el.panelId), record = grid.selModel.getLastSelected(), win.gridId = grid.id, win.SetTypeName(record.raw.属性类型), win.show(), record.data.数据控制规则结构存储 ? win.items.items[0].store.loadData(Ext.decode(unescape(record.data.数据控制规则结构存储))) : win.items.items[0].store.loadData([]), win = record = null
        },
        OnConditionForm: function(el, trigger, index) {
          if (index == 0) el.clientdata = "", el.clientsql = "", el.clientinclude = "", el.setValue("");
          else {
            var win, record, treeOperation;
            if (treeOperation = Util.getCmp("Tree_TreeOperation"), record = treeOperation.selModel.getLastFocused(), !record || !record.isLeaf()) return;
            win = Util.getCmp("WindowConditionForm"), win || (win = Ext.create("Snmon.query.WindowCondition", {
              rawId: "WindowConditionForm",
              listeners: {
                confirm: function(win, grid) {
                  var sql = grid.GetSql(!1);
                  el.clientdata = escape(Ext.encode(grid.GetItems())), el.clientsql = Ext.htmlEncode(sql), el.clientinclude = grid.GetIncludeField(), el.setValue(sql)
                }
              }
            })), win.SetTypeName(record.raw.业务名称), win.show(), el.clientdata ? win.items.items[0].store.loadData(Ext.decode(unescape(el.clientdata))) : win.items.items[0].store.loadData([]), win = record = null
          }
        }
      },
      Button: {
        OnSaveClick: function() {
          var selectedOperation = Util.getCmp("Tree_TreeOperation").selModel.getLastFocused(),
            d;
          selectedOperation ? (d = Snmon.DefaultOperationPowerInstall.Common.PackageData(), d && Snmon.DefaultOperationPowerInstall.Service.OperationPowerSave(d)) : Msg.Normal("请选择业务信息和角色信息!")
        },
        OnUpdatePower: function() {
          Snmon.DefaultOperationPowerInstall.Service.UpdatePower()
        }
      },
      Tree: {
        OnNodeItemClick: function(view, record, item, index, e) {
          if (e && e.target.nodeName != "INPUT" && record.isLeaf()) {
            var selectedOperation = Util.getCmp("Tree_TreeOperation").selModel.getLastFocused();
            selectedOperation && selectedOperation.get("leaf") ? Snmon.DefaultOperationPowerInstall.Service.GetOperationPowerByOperation(selectedOperation.raw.业务名称) : (Snmon.DefaultOperationPowerInstall.PanelData = null, Util.getCmp("GridToolbarPower").store.removeAll(), Snmon.DefaultOperationPowerInstall.Common.移除列表控件())
          }
        }
      }
    },
    Service: {
      OperationPowerSave: function(data) {
        var me = this,
          mask = new Ext.LoadMask(Ext.getBody(), {
            msg: "保存中,请稍等..."
          });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/OperationPowerInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "OperationPowerSave",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("保存成功!", function() {
              var selectedOperation = Util.getCmp("Tree_TreeOperation").selModel.getLastFocused();
              Snmon.DefaultOperationPowerInstall.Service.GetOperationPowerByOperation(selectedOperation.raw.业务名称)
            }) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: me
        })
      },
      GetOperationPowerByOperation: function(boName) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "加载中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/OperationPowerInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "GetOperationPowerByOperation",
            boName: boName,
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? Snmon.DefaultOperationPowerInstall.Common.数据加载(Ext.decode(result)) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      UpdatePower: function() {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "更新中,请稍等..."
        });
        mask.show();
        var _按钮权限 = [],
          _方法权限 = [],
          _列表数据权限, _业务对象集合 = [];
        Ext.each(Snmon.Buttons, function(item) {
          _按钮权限.push(item + "-" + Util.getCmp("Button_" + item).getValue())
        }), Ext.each(Snmon.Methods, function(item) {
          _方法权限.push(item + "-" + Util.getCmp("Method_" + item).getValue())
        }), _列表数据权限 = Util.getCmp("DefaultListDataPower").getValue(), Ext.each(Util.getCmp("Tree_TreeOperation").getChecked(), function(node) {
          node.isLeaf() && _业务对象集合.push(node.raw.业务名称)
        }), Ext.Ajax.request({
          timeout: 12e5,
          url: Config.VPath + "WebServices/System/OperationPowerInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "UpdatePower",
            buttons: _按钮权限.join(","),
            methods: _方法权限.join(","),
            listDataPower: _列表数据权限,
            operations: _业务对象集合.join(",")
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            result == "OK" ? Msg.Normal("默认权限更新完成") : result == "" ? Msg.Normal("更新失败") : Msg.Normal(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Normal(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.ExceptionRecord = {
    Load: function() {
      ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Add", "Modify", "Delete", "Query"]
      }), this.Event.AfterEvent()
    },
    Event: {
      BeforeEvent: function() {},
      AfterEvent: function() {
        var btnView = Util.getCmp("ButtonView");
        btnView && btnView.on("clientbeforeclick", function() {
          var record = Util.getCmp("Grid").selModel.getLastSelected(),
            boName = record.raw.单据类型,
            invoicesId = record.raw.单据ID,
            url;
          return boName && (url = Snmon.service.GetUrlByBoName(boName), url && Url.GotoEditPage("V_" + invoicesId, url, boName, 4, invoicesId)), !1
        })
      }
    }
  }
}(),
function() {
  Snmon.NumberInstall = {
    BoName: null,
    Data: null,
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var treeOperation = this.GetTreeOperation(),
          panel = this.GetForm();
        Util.AddMainPanel([treeOperation, panel], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: Snmon.NumberInstall.Event.Button.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }]), Snmon.NumberInstall.Common.控制控件(!0)
      },
      GetTreeOperation: function() {
        return Snmon.tree.Tree({
          id: "TreeOperation",
          region: "west",
          width: 250,
          minWidth: 200,
          maxWidth: 500,
          bodyStyle: "0px",
          boName: "业务对象信息",
          extraParams: {
            sign: "FindTree",
            treeBoName: "业务对象信息",
            expandHandler: !0
          },
          rootText: "业务对象",
          itemclick: Snmon.NumberInstall.Event.Tree.OnTreeOperationItemClick
        })
      },
      GetForm: function() {
        return Ext.create("Ext.form.Panel", {
          frame: !1,
          region: "center",
          bodyPadding: 5,
          items: [{
            xtype: "radiogroup",
            fieldLabel: "编码规则",
            labelWidth: 60,
            labelSeparator: "",
            items: [{
              id: Util.id("Panel_编码规则"),
              xtype: "combobox",
              name: "编码规则",
              fieldLabel: "",
              margin: "0 5 0 0",
              queryMode: "local",
              editable: !1,
              store: ["手动配置", "系统生成"],
              value: "手动配置"
            }]
          }, {
            xtype: "fieldcontainer",
            fieldLabel: "",
            layout: "hbox",
            labelWidth: 60,
            columns: [200, 50, 200],
            defaults: {
              hideLabel: !0
            },
            items: [{
              xtype: "label",
              text: "长 度",
              margin: "10 50 0 230"
            }, {
              xtype: "label",
              text: "规 则",
              margin: "10 0 0 0"
            }, {
              xtype: "label",
              text: "流水依据",
              margin: "10 0 0 50"
            }]
          }, {
            id: Util.id("Panel_Prefix1_Container"),
            xtype: "fieldcontainer",
            fieldLabel: "前缀一",
            layout: "hbox",
            labelWidth: 60,
            labelSeparator: "",
            columns: [200, 50, 200],
            defaults: {
              hideLabel: !0
            },
            items: [{
              id: Util.id("Panel_Prefix1_业务名称"),
              xtype: "combobox",
              name: "业务名称",
              fieldLabel: "Start",
              margin: "0 5 0 0",
              queryMode: "local",
              valueField: "属性名称",
              displayField: "属性名称",
              allowBlank: !0,
              editable: !1,
              store: Ext.create("Ext.data.Store", {
                fields: ["属性名称", "类型"],
                data: []
              })
            }, {
              id: Util.id("Panel_Prefix1_长度"),
              xtype: "numberfield",
              fieldLabel: "长度",
              margin: "0 5 0 0",
              width: 50,
              minValue: 0,
              maxValue: 18,
              readOnly: !0,
              allowBlank: !0,
              hideTrigger: !0
            }, {
              id: Util.id("Panel_Prefix11_规则"),
              xtype: "textfield",
              fieldLabel: "规则",
              width: 100,
              hidden: !0,
              allowBlank: !0
            }, {
              id: Util.id("Panel_Prefix12_规则"),
              xtype: "combobox",
              name: "规则",
              width: 100,
              fieldLabel: "Start",
              margin: "0 5 0 0",
              queryMode: "local",
              allowBlank: !0,
              store: ["短年月日", "年月日", "短年月", "年月", "年"],
              hidden: !0,
              editable: !1
            }, {
              id: Util.id("Panel_Prefix13_规则"),
              xtype: "combobox",
              name: "规则",
              valueField: "属性名称",
              displayField: "属性名称",
              width: 100,
              fieldLabel: "Start",
              margin: "0 5 0 0",
              queryMode: "local",
              allowBlank: !0,
              store: Ext.create("Ext.data.Store", {
                fields: ["属性名称"],
                data: []
              }),
              hidden: !0,
              editable: !1
            }, {
              id: Util.id("Panel_Prefix1_流水依据"),
              xtype: "checkbox",
              name: "流水依据",
              hidden: !0,
              margin: "0 0 0 25"
            }]
          }, {
            id: Util.id("Panel_Prefix2_Container"),
            xtype: "fieldcontainer",
            fieldLabel: "前缀二",
            layout: "hbox",
            labelWidth: 60,
            labelSeparator: "",
            columns: [200, 50, 200],
            defaults: {
              hideLabel: !0
            },
            items: [{
              id: Util.id("Panel_Prefix2_业务名称"),
              xtype: "combobox",
              name: "业务名称",
              fieldLabel: "Start",
              margin: "0 5 0 0",
              queryMode: "local",
              valueField: "属性名称",
              displayField: "属性名称",
              allowBlank: !0,
              editable: !1,
              store: Ext.create("Ext.data.Store", {
                fields: ["属性名称", "类型"],
                data: []
              })
            }, {
              id: Util.id("Panel_Prefix2_长度"),
              xtype: "numberfield",
              fieldLabel: "长度",
              margin: "0 5 0 0",
              width: 50,
              minValue: 1,
              maxValue: 18,
              readOnly: !0,
              allowBlank: !0,
              hideTrigger: !0
            }, {
              id: Util.id("Panel_Prefix21_规则"),
              xtype: "textfield",
              fieldLabel: "规则",
              width: 100,
              allowBlank: !0,
              hidden: !0
            }, {
              id: Util.id("Panel_Prefix22_规则"),
              xtype: "combobox",
              name: "规则",
              width: 100,
              fieldLabel: "Start",
              margin: "0 5 0 0",
              queryMode: "local",
              allowBlank: !0,
              store: ["短年月日", "年月日", "短年月", "年月", "年"],
              editable: !1,
              hidden: !0
            }, {
              id: Util.id("Panel_Prefix23_规则"),
              xtype: "combobox",
              name: "规则",
              valueField: "属性名称",
              displayField: "属性名称",
              width: 100,
              fieldLabel: "Start",
              margin: "0 5 0 0",
              queryMode: "local",
              allowBlank: !0,
              store: Ext.create("Ext.data.Store", {
                fields: ["属性名称"],
                data: []
              }),
              editable: !1,
              hidden: !0
            }, {
              id: Util.id("Panel_Prefix2_流水依据"),
              xtype: "checkbox",
              name: "流水依据",
              hidden: !0,
              margin: "0 0 0 25"
            }]
          }, {
            id: Util.id("Panel_Prefix3_Container"),
            xtype: "fieldcontainer",
            fieldLabel: "前缀三",
            layout: "hbox",
            labelWidth: 60,
            labelSeparator: "",
            columns: [200, 50, 200],
            defaults: {
              hideLabel: !0
            },
            items: [{
              id: Util.id("Panel_Prefix3_业务名称"),
              xtype: "combobox",
              name: "业务名称",
              fieldLabel: "Start",
              margin: "0 5 0 0",
              queryMode: "local",
              valueField: "属性名称",
              displayField: "属性名称",
              allowBlank: !0,
              editable: !1,
              store: Ext.create("Ext.data.Store", {
                fields: ["属性名称", "类型"],
                data: []
              })
            }, {
              id: Util.id("Panel_Prefix3_长度"),
              xtype: "numberfield",
              fieldLabel: "长度",
              margin: "0 5 0 0",
              width: 50,
              minValue: 1,
              maxValue: 18,
              readOnly: !0,
              allowBlank: !0,
              hideTrigger: !0
            }, {
              id: Util.id("Panel_Prefix31_规则"),
              xtype: "textfield",
              fieldLabel: "规则",
              width: 100,
              allowBlank: !0,
              hidden: !0
            }, {
              id: Util.id("Panel_Prefix32_规则"),
              xtype: "combobox",
              name: "规则",
              width: 100,
              fieldLabel: "Start",
              margin: "0 5 0 0",
              queryMode: "local",
              allowBlank: !0,
              store: ["短年月日", "年月日", "短年月", "年月", "年"],
              editable: !1,
              hidden: !0
            }, {
              id: Util.id("Panel_Prefix33_规则"),
              xtype: "combobox",
              name: "规则",
              valueField: "属性名称",
              displayField: "属性名称",
              width: 100,
              fieldLabel: "Start",
              margin: "0 5 0 0",
              queryMode: "local",
              allowBlank: !0,
              store: Ext.create("Ext.data.Store", {
                fields: ["属性名称"],
                data: []
              }),
              editable: !1,
              hidden: !0
            }, {
              id: Util.id("Panel_Prefix3_流水依据"),
              xtype: "checkbox",
              name: "流水依据",
              hidden: !0,
              margin: "0 0 0 25"
            }]
          }, {
            xtype: "fieldcontainer",
            fieldLabel: "起始值",
            layout: "hbox",
            labelWidth: 60,
            labelSeparator: "",
            columns: [200],
            defaults: {
              hideLabel: !0
            },
            items: [{
              id: Util.id("Panel_起始值"),
              xtype: "numberfield",
              fieldLabel: "起始值",
              margin: "0 5 0 0",
              labelSeparator: "",
              minValue: 1,
              maxLength: 30,
              width: 150,
              allowBlank: !0,
              hideTrigger: !0
            }, {
              id: Util.id("Panel_Stream_长度"),
              xtype: "numberfield",
              fieldLabel: "长度",
              width: 50,
              minValue: 1,
              maxValue: 18,
              allowBlank: !0,
              hideTrigger: !0
            }]
          }, {
            xtype: "fieldcontainer",
            fieldLabel: "单据编号 = ",
            layout: "hbox",
            margin: "30 0 10 0",
            labelWidth: 62,
            labelSeparator: "",
            columns: [200],
            items: [{
              id: Util.id("Panel_Prefix1"),
              xtype: "textfield",
              labelWidth: 5,
              width: 120,
              readOnly: !0,
              hideLabel: !0
            }, {
              id: Util.id("Panel_Prefix2"),
              xtype: "textfield",
              fieldLabel: "+",
              labelWidth: 5,
              width: 120,
              readOnly: !0,
              labelSeparator: ""
            }, {
              id: Util.id("Panel_Prefix3"),
              xtype: "textfield",
              fieldLabel: "+",
              labelWidth: 5,
              width: 120,
              readOnly: !0,
              labelSeparator: ""
            }, {
              id: Util.id("Panel_Stream"),
              xtype: "textfield",
              fieldLabel: "+",
              labelWidth: 5,
              width: 120,
              readOnly: !0,
              value: "",
              labelSeparator: ""
            }]
          }, {
            xtype: "fieldcontainer",
            fieldLabel: "展示效果 = ",
            layout: "hbox",
            labelWidth: 62,
            labelSeparator: "",
            items: [{
              id: Util.id("Panel_展示效果"),
              xtype: "textfield",
              width: 480,
              readOnly: !0,
              hideLabel: !0
            }]
          }]
        })
      }
    },
    Common: {
      PackageData: function() {
        var data, d, _前缀Con, _前缀, _类型, _长度, _规则1, _规则2, _规则3, prefix, oldData, stream_长度, _起始值, id, i;
        if (Snmon.NumberInstall.BoName) {
          if (data = {}, oldData = Snmon.NumberInstall.Data, stream_长度 = Util.getPCmp("Stream_长度").getValue(), _起始值 = Util.getPCmp("起始值").getValue(), id = oldData && oldData.ID || Util.NewGuid(), Util.getPCmp("编码规则").getValue() == "系统生成") {
            for (d = {
                ID: id,
                "BO名字": Snmon.NumberInstall.BoName,
                "编码方式": 1,
                "长度": stream_长度 || 0,
                "起始值": _起始值 || 0,
                "是否有流水号": !0,
                "版本戳": oldData && oldData.版本戳 || "",
                "编号前缀类列表": []
              }, i = 1; i <= 3; i++)
              if (_前缀Con = Util.getPCmp(Ext.String.format("Prefix{0}_业务名称", i)), _类型 = _前缀Con.lastSelection[0].data.类型, _类型 != 4) {
                _前缀 = _前缀Con.getValue(), _长度 = Util.getPCmp(Ext.String.format("Prefix{0}_长度", i)).getValue(), _规则1 = Util.getPCmp(Ext.String.format("Prefix{0}1_规则", i)).getValue(), _规则2 = Util.getPCmp(Ext.String.format("Prefix{0}2_规则", i)).getValue(), _规则3 = Util.getPCmp(Ext.String.format("Prefix{0}3_规则", i)).getValue(), _流水依据 = Util.getPCmp(Ext.String.format("Prefix{0}_流水依据", i)).getValue(), prefix = oldData && this.根据索引获取前缀(oldData.编号前缀类列表, i) || {};
                switch (_类型) {
                  case 0:
                    if (!_长度) return !1;
                    break;
                  case 1:
                    if (!_长度 && _长度 !== 0) return !1;
                    break;
                  case 3:
                    if (!_长度 || _规则1.length != _长度) return !1
                }
                d.编号前缀类列表.push({
                  ID: prefix.ID || Util.NewGuid(),
                  "头表ID": id,
                  "顺序": i,
                  "编号类型": _类型,
                  "前缀名称": _前缀,
                  "长度": _长度,
                  "规则": _类型 === 0 || _类型 === 3 ? _规则1 : _类型 === 1 ? _规则3 : _类型 === 2 ? _规则2 : "",
                  "是否轮回依据": _流水依据,
                  "版本戳": prefix.版本戳 || "",
                  "操作状态ID": prefix.ID ? Config.Modify : Config.Add
                })
              }
          } else
            for (d = {
                ID: id,
                "BO名字": Snmon.NumberInstall.BoName,
                "编码方式": 0,
                "长度": stream_长度 || 0,
                "起始值": _起始值 || 0,
                "是否有流水号": !0,
                "版本戳": oldData && oldData.版本戳 || "",
                "编号前缀类列表": []
              }, i = 1; i <= 3; i++) prefix = oldData && this.根据索引获取前缀(oldData.编号前缀类列表, i), prefix && prefix.ID && d.编号前缀类列表.push({
              ID: prefix.ID,
              "版本戳": prefix.版本戳,
              "操作状态ID": Config.Del
            });
          return d[Config.OperateState] = oldData && oldData.ID ? Config.Modify : Config.Add, data["编号管理"] = d, data
        }
        return !1
      },
      "数据绑定": function(data) {
        var prefix1 = Util.getCmp("Panel_Prefix1_业务名称"),
          prefix2 = Util.getCmp("Panel_Prefix2_业务名称"),
          prefix3 = Util.getCmp("Panel_Prefix3_业务名称");
        data.push({
          "属性名称": "手工录入",
          "类型": 3
        }), data.push({
          "属性名称": "无",
          "类型": 4
        }), prefix1.store.loadData(data), prefix2.store.loadData(data), prefix3.store.loadData(data), prefix1.setValue("无"), prefix2.setValue("无"), prefix3.setValue("无")
      },
      "数据加载": function(data) {
        var items, i, prefix, _长度Con, _规则;
        if (Snmon.NumberInstall.Data = data, !data) {
          Util.getPCmp("编码规则").setValue("手动配置"), this.控制控件(!0);
          return
        }
        if (Util.getPCmp("编码规则").setValue(data.编码方式 == 0 ? "手动配置" : "系统生成"), this.控制控件(data.编码方式 == 0), items = data.编号前缀类列表, items) {
          for (i = 1; i <= 3; i++)
            if (prefix = this.根据索引获取前缀(items, i), prefix) {
              Util.getPCmp(Ext.String.format("Prefix{0}_业务名称", i)).setValue(prefix.前缀名称), _长度Con = Util.getPCmp(Ext.String.format("Prefix{0}_长度", i)), prefix.长度 === 0 ? _长度Con.setValue(0) : _长度Con.setValue(prefix.长度 || "");
              switch (prefix.编号类型) {
                case 1:
                  _规则 = Util.getPCmp(Ext.String.format("Prefix{0}3_规则", i)), _规则.show(), _长度Con.setReadOnly(!1), Snmon.NumberInstall.Service.GetRuleBoProperty(Snmon.NumberInstall.BoName, prefix.前缀名称, _规则, prefix.规则);
                  break;
                case 2:
                  Util.getPCmp(Ext.String.format("Prefix{0}2_规则", i)).setValue(prefix.规则).show();
                  break;
                case 3:
                  Util.getPCmp(Ext.String.format("Prefix{0}1_规则", i)).setValue(prefix.规则).show(), _长度Con.setReadOnly(!1);
                  break;
                default:
                  _长度Con.setReadOnly(!1)
              }
              Util.getPCmp(Ext.String.format("Prefix{0}_流水依据", i)).setValue(prefix.是否轮回依据).show(), Util.getPCmp(Ext.String.format("Prefix{0}", i)).setValue(prefix.前缀名称), Snmon.NumberInstall.Common.流水依据绑定(), prefix.是否轮回依据, this.前缀控件控制(i, !1), i != 3 && this.前缀控件控制(i + 1, !1)
            }
          Util.getPCmp("Stream_长度").setValue(data.长度 || ""), Util.getPCmp("起始值").setValue(data.起始值 || ""), Util.getPCmp("Stream").setValue(Ext.String.leftPad(data.起始值 || "", data.长度, "0")), this.展示效果()
        }
      },
      "初始化": function(_手动编码) {
        if (Util.getPCmp("Prefix1_业务名称").setValue("无"), Util.getPCmp("Prefix2_业务名称").setValue("无"), Util.getPCmp("Prefix3_业务名称").setValue("无"), Util.getPCmp("Prefix1_长度").setValue(""), Util.getPCmp("Prefix2_长度").setValue(""), Util.getPCmp("Prefix3_长度").setValue(""), Util.getPCmp("Prefix11_规则").hide(), Util.getPCmp("Prefix12_规则").hide(), Util.getPCmp("Prefix13_规则").hide(), Util.getPCmp("Prefix21_规则").hide(), Util.getPCmp("Prefix22_规则").hide(), Util.getPCmp("Prefix23_规则").hide(), Util.getPCmp("Prefix31_规则").hide(), Util.getPCmp("Prefix32_规则").hide(), Util.getPCmp("Prefix33_规则").hide(), Util.getPCmp("Prefix1_流水依据").hide(), Util.getPCmp("Prefix2_流水依据").hide(), Util.getPCmp("Prefix3_流水依据").hide(), Util.getPCmp("Prefix1").setValue("无"), Util.getPCmp("Prefix2").setValue("无"), Util.getPCmp("Prefix3").setValue("无"), Util.getPCmp("Prefix1_流水依据").setValue(!1), Util.getPCmp("Prefix2_流水依据").setValue(!1), Util.getPCmp("Prefix3_流水依据").setValue(!1), _手动编码) Util.getPCmp("Stream_长度").setValue("").setReadOnly(!0), Util.getPCmp("起始值").setValue("").setReadOnly(!0), Util.getPCmp("Stream").setValue(""), Util.getPCmp("展示效果").setValue("");
        else {
          Util.getPCmp("Stream_长度").setValue(5).setReadOnly(!1);
          var _起始值Con = Util.getPCmp("起始值").setValue(1);
          _起始值Con.setReadOnly(!1), _起始值Con.setMinValue(1), _起始值Con.setMaxValue(99999), Util.getPCmp("Stream").setValue("00001"), Util.getPCmp("展示效果").setValue("00001")
        }
      },
      "控制控件": function(edit) {
        Util.getPCmp("Prefix1_业务名称").setDisabled(edit), Util.getPCmp("Prefix1_长度").setDisabled(edit), Util.getPCmp("Prefix1").setDisabled(edit), edit === !0 && (Util.getPCmp("Prefix2_业务名称").setDisabled(edit), Util.getPCmp("Prefix2_长度").setDisabled(edit), Util.getPCmp("Prefix2").setDisabled(edit), Util.getPCmp("Prefix3_业务名称").setDisabled(edit), Util.getPCmp("Prefix3_长度").setDisabled(edit), Util.getPCmp("Prefix3").setDisabled(edit)), Util.getPCmp("Stream_长度").setDisabled(edit), Util.getPCmp("起始值").setDisabled(edit)
      },
      "前缀控件控制": function(index, edit) {
        index < 4 && (Util.getPCmp(Ext.String.format("Prefix{0}_业务名称", index)).setDisabled(edit), Util.getPCmp(Ext.String.format("Prefix{0}_长度", index)).setDisabled(edit), Util.getPCmp(Ext.String.format("Prefix{0}", index)).setDisabled(edit))
      },
      "展示效果": function() {
        var count, con, val, len;
        count = (Util.getPCmp("Prefix1_长度").getValue() || 0) + (Util.getPCmp("Prefix2_长度").getValue() || 0) + (Util.getPCmp("Prefix3_长度").getValue() || 0), con = Util.getPCmp("展示效果"), val = Util.getPCmp("起始值").getValue() || "", len = Util.getPCmp("Stream_长度").getValue() || 0, con.setValue(Ext.String.repeat("#", count) + Ext.String.leftPad(val, len, "0"))
      },
      "根据索引获取前缀": function(items, index) {
        for (var item, i = 0; i < 3; i++)
          if (item = items[i], item && item.顺序 == index) return item
      },
      "流水依据绑定": function() {
        var stream = Util.getPCmp("Stream_业务名称"),
          prefix1 = Util.getPCmp("Prefix1_业务名称").getValue(),
          prefix2 = Util.getPCmp("Prefix2_业务名称").getValue(),
          prefix3 = Util.getPCmp("Prefix3_业务名称").getValue(),
          items = [];
        prefix1 != "无" && prefix1 != "手工录入" && items.push({
          "属性名称": prefix1
        }), prefix2 != "无" && prefix2 != "手工录入" && items.push({
          "属性名称": prefix2
        }), prefix3 != "无" && prefix3 != "手工录入" && items.push({
          "属性名称": prefix3
        }), items.push({
          "属性名称": "无"
        }), items.length > 0 ? Util.getPCmp("Stream_长度").setReadOnly(!1) : Util.getPCmp("Stream_长度").setReadOnly(!0)
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {
          var me = this;
          me.前缀Select(1), me.前缀Select(2), me.前缀Select(3), me.长度Change(1), me.长度Change(2), me.长度Change(3), me.日期规则Select(1), me.日期规则Select(2), me.日期规则Select(3);
          Util.getPCmp("Stream_长度").on("blur", this.On流水依据长度Change, this);
          Util.getPCmp("编码规则").on("select", this.On编码规则Change, this)
        },
        "On流水依据长度Change": function(field) {
          var con = Util.getPCmp("起始值"),
            val = field.getValue();
          val && field.maxValue >= val ? (con.setMaxValue(Ext.String.repeat("9", val)), con.setValue(1), con.setReadOnly(!1), Util.getPCmp("Stream").setValue(Ext.String.leftPad(1, val, "0")), Snmon.NumberInstall.Common.展示效果()) : (field.setValue(""), con.setValue(""), con.setReadOnly(!0), Util.getPCmp("Stream").setValue(""))
        },
        "On起始值Change": function(field) {
          var val = field.getValue();
          val && val <= field.maxValue && (Util.getPCmp("Stream").setValue(Ext.String.leftPad(val, Util.getPCmp("Stream_长度").getValue(), "0")), Snmon.NumberInstall.Common.展示效果())
        },
        "On编码规则Change": function(field) {
          var flag = field.getValue();
          Snmon.NumberInstall.Common.初始化(flag == "手动配置"), Snmon.NumberInstall.Common.控制控件(flag == "手动配置")
        },
        "前缀Select": function(_组别) {
          var _业务名称Con = Util.getPCmp(Ext.String.format("Prefix{0}_业务名称", _组别));
          _业务名称Con.组别 = _组别;
          _业务名称Con.on("beforeselect", this.On业务名称BeforeSelect, this);
          _业务名称Con.on("select", this.On业务名称Select, this)
        },
        "On业务名称BeforeSelect": function(combo) {
          combo.lastValue = combo.getValue()
        },
        "On业务名称Select": function(combo) {
          var _组别 = combo.组别,
            con, _长度Con, _规则Con1, _规则Con2, _规则Con3, _流水依据Con, _类型;
          if (_长度Con = Util.getPCmp(Ext.String.format("Prefix{0}_长度", _组别)), _规则Con1 = Util.getPCmp(Ext.String.format("Prefix{0}1_规则", _组别)), _规则Con2 = Util.getPCmp(Ext.String.format("Prefix{0}2_规则", _组别)), _规则Con3 = Util.getPCmp(Ext.String.format("Prefix{0}3_规则", _组别)), _流水依据Con = Util.getPCmp(Ext.String.format("Prefix{0}_流水依据", _组别)), _类型 = combo.lastSelection[0].data, this.判断前缀类型是否相同()) {
            switch (_类型.类型) {
              case 0:
                _长度Con && (_长度Con.setReadOnly(!1), _长度Con.setValue(""), _长度Con.setMinValue(1), _长度Con.setMaxValue(9)), _规则Con1 && (_规则Con1.setValue(""), _规则Con1.hide()), _规则Con2 && (_规则Con2.setValue(""), _规则Con2.hide()), _规则Con3 && (_规则Con3.setValue(""), _规则Con3.hide()), _流水依据Con.hide(), Snmon.NumberInstall.Common.前缀控件控制(_组别 + 1, !1);
                break;
              case 1:
                _长度Con && (_长度Con.setReadOnly(!1), _长度Con.setValue("2"), _长度Con.setMinValue(0)), _规则Con1 && (_规则Con1.setValue(""), _规则Con1.hide()), _规则Con2 && (_规则Con2.setValue(""), _规则Con2.hide()), _规则Con3 && (_规则Con3.setValue(""), _规则Con3.show()), _流水依据Con.show(), Snmon.NumberInstall.Service.GetRuleBoProperty(Snmon.NumberInstall.BoName, _类型.属性名称, _规则Con3), Snmon.NumberInstall.Common.前缀控件控制(_组别 + 1, !1);
                break;
              case 2:
                _长度Con && (_长度Con.setReadOnly(!0), _长度Con.setValue(8)), _规则Con1 && (_规则Con1.setValue(""), _规则Con1.hide()), _规则Con2 && (_规则Con2.setValue("年月日"), _规则Con2.show()), _规则Con3 && (_规则Con3.setValue(""), _规则Con3.hide()), _流水依据Con.show(), Snmon.NumberInstall.Common.前缀控件控制(_组别 + 1, !1);
                break;
              case 3:
                _长度Con && (_长度Con.setReadOnly(!1), _规则Con1.allowBlank = !1, _规则Con1.minLength = 2, _规则Con1.maxLength = 2, _长度Con.setValue(2), _长度Con.setMinValue(1)), _规则Con1 && (_规则Con1.setValue(""), _规则Con1.show()), _规则Con2 && (_规则Con2.setValue(""), _规则Con2.hide()), _规则Con3 && (_规则Con3.setValue(""), _规则Con3.hide()), _流水依据Con.show(), Snmon.NumberInstall.Common.前缀控件控制(_组别 + 1, !1);
                break;
              default:
                _组别 < 3 && Util.getPCmp(Ext.String.format("Prefix{0}_业务名称", _组别 + 1)).getValue() != "无" ? combo.setValue(combo.lastValue) : (_长度Con && (_长度Con.setReadOnly(!0), _长度Con.setValue("")), _规则Con1 && (_规则Con1.setValue(""), _规则Con1.hide()), _规则Con2 && (_规则Con2.setValue(""), _规则Con2.hide()), _规则Con3 && (_规则Con3.setValue(""), _规则Con3.hide()), _流水依据Con.hide(), Snmon.NumberInstall.Common.前缀控件控制(_组别 + 1, !0))
            }
            con = Util.getPCmp(Ext.String.format("Prefix{0}", _组别)), con.setValue(combo.getValue())
          } else _组别 < 3 && Util.getPCmp(Ext.String.format("Prefix{0}_业务名称", _组别 + 1)).getValue() != "无" ? combo.setValue(combo.lastValue) : (combo.setValue("无"), combo.fireEvent("select", combo));
          Snmon.NumberInstall.Common.流水依据绑定(), Snmon.NumberInstall.Common.展示效果(), con = null, _业务名称Con = null, _长度Con = null, _规则Con1 = null, _规则Con2 = null, _规则Con3 = null
        },
        "长度Change": function(_组别) {
          var con = Util.getPCmp(Ext.String.format("Prefix{0}_长度", _组别));
          con.组别 = _组别;
          con.on("blur", this.On长度Change, this)
        },
        "On长度Change": function(field) {
          var val = field.getValue(),
            con;
          val >= field.minValue && val <= field.maxValue ? Snmon.NumberInstall.Common.展示效果() : (val = 2, field.setValue(val)), con = Util.getPCmp(Ext.String.format("Prefix{0}1_规则", field.组别)), con.minLength = val, con.maxLength = val
        },
        "日期规则Select": function(_组别) {
          var _规则Con = Util.getPCmp(Ext.String.format("Prefix{0}2_规则", _组别));
          _规则Con.组别 = _组别;
          _规则Con.on("select", this.On日期规则Select, this)
        },
        "On日期规则Select": function(combo) {
          var _长度Con = Util.getPCmp(Ext.String.format("Prefix{0}_长度", combo.组别)),
            _长度 = combo.getValue(),
            len = _长度 == "年月日" ? 8 : _长度 == "年月" || _长度 == "短年月日" ? 6 : _长度 == "短年月" ? 4 : 4;
          _长度Con.setValue(len), Snmon.NumberInstall.Common.展示效果()
        },
        "判断前缀类型是否相同": function() {
          var prefix1 = Util.getCmp("Panel_Prefix1_业务名称").getValue(),
            prefix2 = Util.getCmp("Panel_Prefix2_业务名称").getValue(),
            prefix3 = Util.getCmp("Panel_Prefix3_业务名称").getValue();
          return prefix1 == "无" && prefix2 == "无" || prefix2 == "无" && prefix3 == "无" || prefix1 == "无" && prefix3 == "无" ? !0 : prefix1 == "手工录入" && prefix2 == "手工录入" || prefix2 == "手工录入" && prefix3 == "手工录入" || prefix1 == "手工录入" && prefix3 == "手工录入" ? !0 : prefix1 == prefix2 || prefix1 == prefix3 || prefix2 == prefix3 ? !1 : !0
        }
      },
      Button: {
        OnSaveClick: function() {
          var d = Snmon.NumberInstall.Common.PackageData();
          d && Snmon.NumberInstall.Service.NumberSave(d)
        }
      },
      Tree: {
        OnTreeOperationItemClick: function(view, record) {
          if (record.isLeaf()) {
            var boName = record.get("id");
            Snmon.NumberInstall.BoName = boName, Snmon.NumberInstall.Service.GetNumberByOperation(boName)
          }
        }
      }
    },
    Service: {
      NumberSave: function(data) {
        var me = this,
          mask = new Ext.LoadMask(Ext.getBody(), {
            msg: "保存中,请稍等..."
          });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/NumberInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "NumberSave",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("保存成功!", function() {
              var tree = Util.getCmp("Tree_TreeOperation"),
                record = tree.selModel.getLastSelected();
              me.GetNumberByOperation(record.get("text"))
            }) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: me
        })
      },
      GetNumberByOperation: function(boName) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "加载中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/NumberInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "GetNumberByOperation",
            boName: boName,
            page: Util.getPageName()
          },
          success: function(r) {
            var result, common, data;
            mask.hide(), result = r.responseText, r.status == 200 ? (common = Snmon.NumberInstall.Common, data = Ext.decode(result), common.初始化(data.编号管理 == null || data.编号管理.编码方式 === 0), common.数据绑定(data.编号BO属性), common.数据加载(data.编号管理)) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      GetRuleBoProperty: function(boName, property, combo, value) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "加载中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/NumberInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "GetRuleBoProperty",
            boName: boName,
            property: property,
            page: Util.getPageName()
          },
          success: function(r) {
            var result, data;
            mask.hide(), result = r.responseText, r.status == 200 ? (data = Ext.decode(result), combo.store.loadData(data), data.length > 0 && combo.setValue(value || data[0].属性名称)) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.OperationInfo = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        Util.SetPageState(1);
        var operationInfo = Snmon.OperationInfo,
          buttonEvent = operationInfo.Event.Button,
          grid = this.GetGrid();
        Util.AddMainPanel([grid], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-add",
          handler: buttonEvent.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonUpdate"),
          text: "更新",
          iconCls: "icon-save",
          handler: buttonEvent.OnUpdateClick
        }, {
          componentType: "button",
          id: Util.id("ButtonFormConfig"),
          text: "表单配置",
          ctype: "表单",
          disabled: !0,
          iconCls: "icon-config",
          handler: buttonEvent.OnConfigClick
        }, {
          componentType: "button",
          id: Util.id("ButtonGridConfig"),
          text: "列表配置",
          ctype: "列表",
          disabled: !0,
          iconCls: "icon-config",
          handler: buttonEvent.OnConfigClick
        }, {
          componentType: "button",
          id: Util.id("ButtonQueryConfig"),
          text: "常用条件配置",
          ctype: "常用条件",
          disabled: !0,
          iconCls: "icon-config",
          handler: buttonEvent.OnConfigClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }])
      },
      GetGrid: function() {
        var grid = Snmon.grid.Grid({
          id: "Grid",
          autoLoad: !0,
          paging: !0,
          addRow: !0,
          delRow: !0,
          region: "center",
          canEditor: !0,
          config: !1,
          boName: "业务对象信息",
          root: "data",
          extraParams: {
            sign: "PagingFind",
            boName: "业务对象信息",
            queryableToList: !0,
            cName: "",
            sql: "",
            dataShowWay: "管理展示"
          },
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "名称",
            dataType: "string",
            width: 120,
            allowBlank: !1,
            componentType: "文本控件",
            maxLength: 32
          }, {
            fieldLabel: "别名",
            dataType: "string",
            width: 100,
            componentType: "文本控件",
            maxLength: 32
          }, {
            fieldLabel: "分组名",
            width: 90,
            dataType: "string",
            componentType: "扩展控件二"
          }, {
            fieldLabel: "显示属性",
            dataType: "string",
            width: 80,
            componentType: "文本控件",
            maxLength: 32
          }, {
            fieldLabel: "配编号",
            property: "是否需配编号",
            dataType: "boolean",
            width: 45,
            componentType: "复选控件"
          }, {
            fieldLabel: "配权限",
            property: "是否需配权限",
            dataType: "boolean",
            width: 45,
            componentType: "复选控件"
          }, {
            fieldLabel: "配审核",
            property: "是否需配审核",
            dataType: "boolean",
            width: 45,
            componentType: "复选控件"
          }, {
            fieldLabel: "业务对象编号属性",
            property: "业务对象编号属性XML",
            dataType: "string",
            width: 120,
            showName: "Name",
            displayField: "Name",
            valueField: "Name",
            multiSelect: !0,
            componentType: "下拉控件"
          }, {
            fieldLabel: "默认网址",
            dataType: "string",
            width: 250,
            componentType: "文本控件",
            maxLength: 256
          }]
        });
        return grid.view.getRowClass = Util.列表行样式, grid
      }
    },
    Common: {
      PackagePageData: function() {
        var data = {},
          items = [],
          item, store, dataItems, removed, grid = Util.getCmp("Grid"),
          i;
        for (store = grid.store, store.read(), dataItems = (store.clientSnapshot || store.data).items, removed = store.snapshotRemoved || store.removed, i = dataItems.length - 1; i >= 0; i--)
          if (item = dataItems[i], item.newRecord === !0) {
            if (!item.isValid()) return !1;
            item.data[Config.OperateState] = Config.Add, items.push(item.data)
          } else if (!Util.IsEmptyObject(item.modified)) {
          if (!item.isValid()) return !1;
          item.data[Config.OperateState] = Config.Modify, Ext.isArray(item.data.业务对象编号属性XML) && (item.data.业务对象编号属性XML = item.data.业务对象编号属性XML.join(",")), items.push(item.data)
        }
        for (i = removed.length - 1; i >= 0; i--) item = removed[i], item.newRecord !== !0 && (item.data[Config.OperateState] = Config.Del, items.push(item.data));
        return data[grid.boName] = items, data
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {
          Util.OnComponent("clientconfigtoolbar", this.OnGridConfigToolbar, this)
        },
        OnGridConfigToolbar: function(toolbar) {
          toolbar.id == Util.id("GridConfigToolbar") && toolbar.add(2, "-", "分组名", Snmon.field.Expand2({
            id: "Field_分组名",
            width: 100,
            dataType: "string"
          }), "名称", {
            id: Util.id("Field_名称"),
            xtype: "textfield",
            width: 100
          }, {
            text: "过滤",
            handler: function() {
              Util.getCmp("Grid").store.loadPage(1)
            }
          })
        }
      },
      AfterEvent: {
        Init: function() {
          var me = this,
            grid = Util.getCmp("Grid"),
            btn = Util.getCmp("ButtonQuery");
          grid.on("select", me.OnGridSelect);
          grid.on("deselect", me.OnGridDeSelect);
          grid.on("beforeedit", me.OnGridBeforeEdit);
          grid.store.on("beforeload", this.OnGridBeforeLoad, this);
          grid.store.on("load", me.OnGridLoad);
          this.Field.Init()
        },
        OnGridSelect: function() {
          var btnFormConfig = Util.getCmp("ButtonFormConfig"),
            btnGridConfig = Util.getCmp("ButtonGridConfig"),
            btnQueryConfig = Util.getCmp("ButtonQueryConfig"),
            btnDelRow = Util.getCmp("GridDelRow");
          btnFormConfig && btnFormConfig.enable(), btnGridConfig && btnGridConfig.enable(), btnQueryConfig && btnQueryConfig.enable(), btnDelRow && btnDelRow.enable()
        },
        OnGridDeSelect: function() {
          var btnFormConfig = Util.getCmp("ButtonFormConfig"),
            btnGridConfig = Util.getCmp("ButtonGridConfig"),
            btnQueryConfig = Util.getCmp("ButtonQueryConfig"),
            btnDelRow = Util.getCmp("GridDelRow");
          btnFormConfig && btnFormConfig.disable(), btnGridConfig && btnGridConfig.disable(), btnQueryConfig && btnQueryConfig.disable(), btnDelRow && btnDelRow.disable()
        },
        OnGridBeforeEdit: function(editor, e) {
          if (e.field == "业务对象编号属性XML") {
            if (!e.record.get("是否需配编号")) return !1;
            Util.getCmp("Grid_业务对象编号属性XML").store.load()
          } else if (["配编号", "配权限", "配审核"].indexOf(e.field) != -1) return !1
        },
        OnGridBeforeLoad: function(store) {
          var _分组名 = Util.getCmp("Field_分组名").getValue().trim(),
            _名称 = Util.getCmp("Field_名称").getValue().trim(),
            sqls = [];
          _分组名 && sqls.push('分组名!=null and 分组名.Contains("' + _分组名 + '")'), _名称 && sqls.push('名称!=null and 名称.Contains("' + _名称 + '")'), store.setExtraParams("sql", sqls.join(" and "))
        },
        OnGridLoad: function(store, records) {
          Ext.each(records, function(item) {
            item.raw.业务对象编号属性XML = item.data.业务对象编号属性XML = item.raw.业务对象编号属性XML.split(",")
          })
        },
        Field: {
          Init: function() {
            Util.getCmp("Field_分组名").on("clientshow", function(el) {
              Snmon.window.TreeWindow({
                id: "ModelTree",
                rootText: "模块",
                extraParams: {
                  sign: "FindTree",
                  expandHandler: !0
                },
                itemdblclick: function(view, record) {
                  el.setValue(record.get("text")), Util.WindowHideOrClose(Util.getCmp("TreeWindow_ModelTree"))
                }
              })
            });
            Util.getCmp("Grid_分组名").on("clientshow", function() {
              Snmon.window.TreeWindow({
                id: "ModelTree2",
                rootText: "模块",
                extraParams: {
                  sign: "FindTree",
                  expandHandler: !0
                },
                itemdblclick: function(view, record) {
                  var selected = Util.getCmp("Grid").selModel.getLastSelected();
                  selected && selected.set("分组名", record.get("text")), Util.WindowHideOrClose(Util.getCmp("TreeWindow_ModelTree2"))
                }
              })
            });
            Util.getCmp("Grid_业务对象编号属性XML").store.on("beforeload", function(store) {
              var record = Util.getCmp("Grid").selModel.getLastSelected();
              store.proxy.url = Config.VPath + "WebServices/System/OperationInfoHandler.ashx", store.setExtraParams("sign", "GetFieldByBoName"), store.setExtraParams("boName", record.get("名称"))
            });
            Util.getCmp("Grid_业务对象编号属性XML").store.on("load", function() {
              Util.getCmp("Grid_业务对象编号属性XML").setValue(Util.getCmp("Grid").selModel.getLastSelected().get("业务对象编号属性XML"))
            })
          }
        }
      },
      Button: {
        OnConfigClick: function(btn) {
          var grid = Util.getCmp("Grid"),
            record = grid.selModel.getLastSelected();
          record ? Url.GotoPage(record, "ConfigViews/ComponentConfig.aspx", {
            boName: record.get("名称"),
            cType: btn.ctype,
            cName: ""
          }) : Msg.Normal("请选择...")
        },
        OnSaveClick: function() {
          var grid = Util.getCmp("Grid"),
            operationInfo = Snmon.OperationInfo,
            data;
          if (data = operationInfo.Common.PackagePageData(), data === !1) {
            Msg.Normal("数据格式错误!");
            return
          }
          data[grid.boName].length > 0 ? operationInfo.Service.保存业务信息(data) : Msg.Normal("没有需要保存的数据!")
        },
        OnUpdateClick: function() {
          Snmon.OperationInfo.Service.更新业务信息()
        }
      }
    },
    Service: {
      "保存业务信息": function(data) {
        Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/OperationInfoHandler.ashx",
          method: "POST",
          params: {
            sign: "SaveOperationInfo",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            var result = r.responseText;
            r.status == 200 && result == "OK" ? Msg.Normal("保存成功!", function() {
              Util.getCmp("Grid").store.loadPage(1)
            }) : Msg.Failure(result)
          },
          failure: function(r) {
            Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      "更新业务信息": function() {
        mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "更新中,请稍等..."
        }), mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/OperationInfoHandler.ashx",
          method: "POST",
          params: {
            sign: "UpdateOperationInfo"
          },
          success: function(r) {
            r.responseText == "OK" ? (mask.hide(), Util.getCmp("Grid").store.loadPage(1)) : Msg.Error(r.responseText)
          },
          failure: function(r) {
            Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.OperationPowerInstall = {
    GridIds: [],
    PanelData: null,
    Load: function() {
      this.Event.Before.Init(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var treeOperation, treeRole, formPower, gridToolbarPower, gridMethodPower, panel, treeDepartment, gridUser, gridRole;
        treeOperation = this.GetTreeOperation(), treeRole = this.GetTreeRole(), formPower = this.GetFormPower(), gridToolbarPower = this.GetGridToolbarPower(), gridMethodPower = this.GetGridMethodPower(), treeDepartment = this.GetTreeDepartment(), treeDepartment.flex = 1, gridUser = this.GetGridUser(), gridUser.flex = 1, gridRole = this.GetGridRole(), gridRole.flex = 1, panel = Ext.create("Ext.Panel", {
          title: "基础权限",
          bodyStyle: "border:0px;",
          layout: {
            type: "vbox",
            align: "stretch"
          },
          items: [formPower, treeDepartment, gridUser, gridRole]
        }), Util.AddMainPanel([{
          width: 350,
          region: "west",
          layout: {
            type: "hbox",
            align: "stretch"
          },
          bodyStyle: "border:0px;",
          items: [treeRole, treeOperation]
        }, {
          region: "center",
          layout: "border",
          bodyStyle: "border:0px;",
          items: [{
            id: Util.id("TabForm"),
            xtype: "tabpanel",
            region: "center",
            bodyStyle: "border-top:0px;",
            items: [panel, gridToolbarPower, gridMethodPower]
          }]
        }], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: Snmon.OperationPowerInstall.Event.Button.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonDelete"),
          text: "删除",
          iconCls: "icon-save",
          handler: Snmon.OperationPowerInstall.Event.Button.OnDeleteClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRoleCopy"),
          text: "权限拷贝",
          iconCls: "icon-save",
          handler: Snmon.OperationPowerInstall.Event.Button.OnCopyClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRolePartCopy"),
          text: "部分业务权限拷贝",
          iconCls: "icon-save",
          handler: Snmon.OperationPowerInstall.Event.Button.OnPartCopyClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }])
      },
      GetFormPower: function() {
        return Ext.create("Ext.form.Panel", {
          xtype: "form",
          id: Util.id("FormPower"),
          bodyPadding: 5,
          title: "",
          layout: {
            type: "table",
            columns: 1
          },
          items: [{
            id: Util.id("Panel_数据控制规则字符"),
            fieldLabel: "数据控制规则字符",
            xtype: "triggerfield",
            labelAlign: "right",
            labelSeparator: "",
            ctype: "expand",
            editable: !1,
            width: 450,
            trigger1Cls: "x-form-clear-trigger",
            trigger2Cls: "x-form-elp-trigger",
            listeners: {
              triggerclick: Snmon.OperationPowerInstall.Event.After.OnConditionForm
            }
          }, {
            id: Util.id("Panel_列表数据权限"),
            fieldLabel: "列表数据权限",
            xtype: "combo",
            labelSeparator: "",
            editable: !1,
            queryMode: "local",
            store: Snmon.ListDataPower,
            value: Snmon.ListDataPower && Snmon.ListDataPower[0],
            listeners: {
              change: function(field, newValue) {
                newValue == "移除" && field.setValue("")
              }
            }
          }]
        })
      },
      GetTreeDepartment: function() {
        return Snmon.tree.Tree({
          id: "Department",
          title: "组织架构",
          maxWidth: 5e3,
          width: null,
          rootVisible: !1,
          bodyStyle: "0px",
          boName: "组织架构",
          autoLoad: !1,
          extraParams: {
            sign: "FindTree",
            treeBoName: "组织架构",
            expandHandler: !0
          },
          rootText: "组织架构",
          rootId: "333334AD-2242-4481-9CA3-6CABEC5E6790",
          beforeload: function(store) {
            var treeRole, treeOperation, roleRecord, operationRecord, _列表数据权限Cmp, _列表数据权限;
            if (treeRole = Util.getCmp("Tree_TreeRole"), treeOperation = Util.getCmp("Tree_TreeOperation"), _列表数据权限Cmp = Util.getCmp("Panel_列表数据权限"), _列表数据权限 = _列表数据权限Cmp.getValue(), roleRecord = treeRole.selModel.getLastFocused(), operationRecord = treeOperation.selModel.getLastFocused(), !roleRecord || !operationRecord || _列表数据权限 != "明细配置") return store.getRootNode().childNodes.length == 0 ? !1 : !0;
            store.setExtraParams("roleId", roleRecord.get("id")), store.setExtraParams("typeName", operationRecord.raw.业务名称)
          }
        })
      },
      GetTreeOperation: function() {
        return Snmon.tree.Tree({
          id: "TreeOperation",
          region: "west",
          title: "业务信息",
          rootVisible: !1,
          width: 175,
          bodyStyle: "0px",
          boName: "业务对象信息",
          extraParams: {
            sign: "FindTree",
            treeBoName: "业务对象信息",
            expandHandler: !0
          },
          rootText: "业务对象",
          itemclick: Snmon.OperationPowerInstall.Event.Tree.OnNodeItemClick
        })
      },
      GetTreeRole: function() {
        return Snmon.tree.Tree({
          id: "TreeRole",
          region: "west",
          title: "角色信息",
          rootVisible: !1,
          width: 175,
          bodyStyle: "0px",
          boName: "角色信息",
          extraParams: {
            sign: "FindTree",
            treeBoName: "角色",
            expandHandler: !0
          },
          rootText: "角色",
          itemclick: Snmon.OperationPowerInstall.Event.Tree.OnNodeItemClick
        })
      },
      GetGridToolbarPower: function() {
        return Snmon.grid.Grid({
          id: "GridToolbarPower",
          title: "按钮权限",
          config: !1,
          addRow: !1,
          delRow: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象工具栏权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "按钮名称",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "按钮权限状态",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            store: Snmon.ToolbarPower,
            componentType: "下拉扩展控件"
          }]
        })
      },
      GetGridMethodPower: function() {
        return Snmon.grid.Grid({
          id: "GridMethodPower",
          title: "方法权限",
          config: !1,
          addRow: !1,
          delRow: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象列表方法权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "方法名称",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "方法权限状态",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            store: Snmon.ToolbarPower,
            componentType: "下拉扩展控件"
          }]
        })
      },
      GetGridUser: function() {
        return Snmon.grid.Grid({
          id: "GridUser",
          title: "用户",
          config: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象用户权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "用户",
            property: "用户",
            width: 120,
            dataType: "object",
            allowBlank: !1,
            showName: "名称",
            propertyType: "员工",
            componentType: "查询控件"
          }]
        })
      },
      GetGridRole: function() {
        return Snmon.grid.Grid({
          id: "GridRole",
          title: "角色",
          config: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象角色权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "角色",
            property: "角色",
            width: 120,
            dataType: "object",
            allowBlank: !1,
            showName: "名称",
            propertyType: "角色",
            componentType: "查询控件"
          }]
        })
      }
    },
    Common: {
      GetGridPropertyPower: function(boName, title) {
        return Snmon.grid.Grid({
          id: "Grid" + boName,
          title: title || boName + "属性权限",
          config: !1,
          addRow: !1,
          delRow: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "业务对象属性权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性类型",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性名称",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "属性权限",
            property: "属性权限状态",
            width: 65,
            dataType: "string",
            allowBlank: !1,
            store: Snmon.PropertyPower,
            componentType: "下拉扩展控件"
          }, {
            fieldLabel: "属性类型",
            width: 100,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件"
          }, {
            fieldLabel: "属性默认值",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件"
          }, {
            fieldLabel: "数据控制规则字符",
            width: 200,
            dataType: "string",
            allowBlank: !0,
            componentType: "扩展控件"
          }, {
            fieldLabel: "数据控制规则结构存储",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "数据控制关联查询字符",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性类型显示属性",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "数据类型",
            dataType: "string",
            configType: "展示隐藏"
          }]
        })
      },
      "打包列表数据": function(grid, headId, datas, boName) {
        var items, data, item, i, ln;
        if (!grid) return !1;
        for (items = grid.store.data.items, i = 0, ln = items.length; i < ln; i++) {
          if (item = items[i], Snmon.data.列表行数据验证和提示(item, i) === !1) return !1;
          data = Ext.apply(item.raw || {}, item.data), data.分组名 = boName, data[Config.headId] = headId, data[Config.OperateState] = !data[Config.OperateState] || data[Config.OperateState] == Config.EmptyGuid ? Config.Add : Config.Modify, datas.push(data)
        }
      },
      PackageData: function() {
        var data = Snmon.OperationPowerInstall.PanelData,
          items = Snmon.OperationPowerInstall.GridIds,
          propertyData = [],
          toolbarData = [],
          methodData = [],
          userData = [],
          roleData = [],
          departmentData = [],
          flag, treeDepartment, departmentRecords, _数据控制规则字符Cmp, i, len;
        if (!data || (_数据控制规则字符Cmp = Util.getPanelCmp("数据控制规则字符"), d = data.业务对象权限, d.列表数据权限 = Util.getPanelCmp("列表数据权限").getValue(), d.数据控制规则字符 = _数据控制规则字符Cmp.clientsql, d.数据控制规则结构存储 = _数据控制规则字符Cmp.clientdata, d.数据控制关联查询字符 = _数据控制规则字符Cmp.clientinclude, d[Config.OperateState] = d[Config.OperateState] == Config.EmptyGuid ? Config.Add : Config.Modify, flag = this.打包列表数据(Util.getCmp("GridToolbarPower"), d[Config.id], toolbarData), flag === !1) || (flag = this.打包列表数据(Util.getCmp("GridMethodPower"), d[Config.id], methodData), flag === !1) || (flag = this.打包列表数据(Util.getCmp("GridUser"), d[Config.id], userData), flag === !1) || (flag = this.打包列表数据(Util.getCmp("GridRole"), d[Config.id], roleData), flag === !1)) return !1;
        for (i = 0, len = items.length; i < len; i++)
          if (flag = this.打包列表数据(Util.getCmp(items[i]), d[Config.id], propertyData, items[i].replace("Grid", "")), flag === !1) return !1;
        return treeDepartment = Util.getCmp("Tree_Department"), departmentRecords = treeDepartment.getChecked(), Ext.each(departmentRecords, function(item) {
          departmentData.push({
            ID: Util.NewGuid(),
            "头表ID": d[Config.id],
            "部门ID": item.get("id"),
            "操作状态ID": Config.Add
          })
        }), d.业务对象属性权限列表 = propertyData, d.业务对象工具栏权限列表 = toolbarData, d.业务对象列表方法权限列表 = methodData, d.可查看用户明细列表 = userData, d.可查看角色明细列表 = roleData, d.可查看部门明细列表 = departmentData, data
      },
      "数据加载": function(data) {
        var items, tab, id, boName, _列表数据权限Cmp, _数据控制规则字符Cmp, _业务对象权限, treeDepartment;
        this.移除列表控件(), items = [], tab = Util.getCmp("TabForm");
        for (id in data)
          if (["Panel", "GridToolbarPower", "GridMethodPower", "GridUser", "GridRole"].indexOf(id) == -1) {
            items.push(id), boName = id.replace("Grid", ""), grid = this.GetGridPropertyPower(boName, boName), tab.add(grid);
            grid.on("beforeedit", Snmon.OperationPowerInstall.Event.After.Grid.OnGridBeforeEdit, Snmon.OperationPowerInstall.Event.After.Grid);
            grid.on("edit", Snmon.OperationPowerInstall.Event.After.Grid.OnGridEdit);
            _数据控制规则字符Cmp = Util.getCmp(id + "_数据控制规则字符");
            _数据控制规则字符Cmp.on("clientshow", Snmon.OperationPowerInstall.Event.After.OnCondition, Snmon.OperationPowerInstall.Event.After);
            _数据控制规则字符Cmp.on("clientclear", function() {
              grid.selModel.getLastSelected().set("数据控制规则字符", "")
            });
            grid.store.loadRawData(data[id])
          } else id == "Panel" ? (Snmon.OperationPowerInstall.PanelData = data[id], _业务对象权限 = data[id].业务对象权限, _列表数据权限Cmp = Util.getPanelCmp("列表数据权限"), _列表数据权限Cmp.setValue(_业务对象权限.列表数据权限), _数据控制规则字符Cmp = Util.getPanelCmp("数据控制规则字符"), _数据控制规则字符Cmp.clientdata = _业务对象权限.数据控制规则结构存储, _数据控制规则字符Cmp.clientsql = _业务对象权限.数据控制规则字符, _数据控制规则字符Cmp.clientinclude = _业务对象权限.数据控制关联查询字符, _数据控制规则字符Cmp.setValue(Ext.htmlDecode(_业务对象权限.数据控制规则字符)), treeDepartment = Util.getCmp("Tree_Department"), _业务对象权限.列表数据权限 == "明细配置" ? treeDepartment.store.load() : (treeDepartment.store.setExtraParams("roleId", ""), treeDepartment.store.load())) : Util.getCmp(id).store.loadRawData(data[id]);
        Snmon.OperationPowerInstall.GridIds = items
      },
      "移除列表控件": function() {
        for (var items = Snmon.OperationPowerInstall.GridIds, tab = Util.getCmp("TabForm"), i = 0, len = items.length; i < len; i++) tab.remove(Util.getCmp(items[i]))
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {
          this.Grid.Init();
          var _列表数据权限Cmp, gridRole, gridUser, _用户Cmp;
          _列表数据权限Cmp = Util.getCmp("Panel_列表数据权限");
          _列表数据权限Cmp.on("select", this.On列表数据权限Select, this);
          gridUser = Util.getCmp("GridUser");
          gridUser.on("select", this.OnGridUserSelect, this);
          gridUser.on("deselect", this.OnGridUserSelect, this);
          gridUser.store.on("clientbeforeaddrow", this.OnGridUserStoreAdd, this);
          gridRole = Util.getCmp("GridRole");
          gridRole.on("select", this.OnGridRoleSelect, this);
          gridRole.on("deselect", this.OnGridRoleSelect, this);
          gridRole.store.on("clientbeforeaddrow", this.OnGridRoleStoreAdd, this);
          _用户Cmp = Util.getCmp("GridUser_用户"), _用户Cmp.events.clientfilteralreadyselect = !0
        },
        "On列表数据权限Select": function(combo) {
          var _列表数据权限, treeDepartment;
          treeDepartment = Util.getCmp("Tree_Department"), _列表数据权限 = combo.getValue(), _列表数据权限 != "明细配置" && treeDepartment.store.setExtraParams("roleId", ""), treeDepartment.selModel.lastSelected = null, treeDepartment.store.load()
        },
        OnGridUserSelect: function(rowModel) {
          var records, delRow;
          delRow = Util.getCmp("GridUserDelRow"), records = rowModel.getSelection(), records.length > 0 ? delRow.enable() : delRow.disable()
        },
        OnGridUserStoreAdd: function() {
          var treeRole, treeOperation, roleRecord, operationRecord;
          return treeRole = Util.getCmp("Tree_TreeRole"), treeOperation = Util.getCmp("Tree_TreeOperation"), roleRecord = treeRole.selModel.getLastFocused(), operationRecord = treeOperation.selModel.getLastFocused(), !roleRecord || !operationRecord ? !1 : void 0
        },
        OnGridRoleSelect: function(rowModel) {
          var records, delRow;
          delRow = Util.getCmp("GridRoleDelRow"), records = rowModel.getSelection(), records.length > 0 ? delRow.enable() : delRow.disable()
        },
        OnGridRoleStoreAdd: function() {
          var treeOperation, operationRecord;
          return treeOperation = Util.getCmp("Tree_TreeOperation"), operationRecord = treeOperation.selModel.getLastFocused(), operationRecord ? void 0 : !1
        },
        Grid: {
          Init: function() {
            Util.getCmp("GridToolbarPower").on("beforeedit", this.OnGridBeforeEdit, this)
          },
          OnGridBeforeEdit: function(editor, e) {
            var field, record, items;
            if (field = e.field, record = e.record, ["属性名称", "按钮名称", "方法名称", "属性类型"].indexOf(field) != -1) return !1;
            if (["权限控制属性", "数据权限", "数据控制规则"].indexOf(field) != -1) {
              if (field == "数据权限" && record.raw.是否区域部门) return !0;
              if (record.get("属性类型") && (field != "数据权限" || record.get("权限控制属性")) && (field != "权限控制属性" || !record.raw.是否区域部门)) items = [], Ext.each(Ext.decode(record.raw.待控制属性集合), function(item) {
                items.push({
                  id: item,
                  field1: item
                })
              }), Util.getCmp(e.grid.id + "_权限控制属性").store.loadData(items);
              else return !1
            } else if (field == "数据控制规则字符") return record.raw.属性类型 ? !0 : !1;
            this.默认值的编辑(editor, e)
          },
          OnGridEdit: function(editor, e) {
            var field, record;
            field = e.field, record = e.record, field == "权限控制属性" && !record.get("数据权限") && e.value ? record.set("数据权限", "查看所有级别") : e.value || field != "权限控制属性" || record.set("数据权限", "")
          },
          "默认值的编辑": function(editor, e) {
            if (e.field == "属性默认值") {
              var record = e.record,
                dtype = record.get("数据类型"),
                field;
              switch (dtype) {
                case "int":
                case "float":
                  field = Snmon.field.Number({
                    hideLabel: !1
                  });
                  break;
                case "object":
                  field = Ext.form.field.Trigger({
                    id: Util.id("Query_" + record.get("属性名称").replace(/\./g, "_")),
                    xtype: "triggerfield",
                    trigger1Cls: "x-form-clear-trigger",
                    trigger2Cls: "x-form-elp-trigger",
                    hideLabel: !1,
                    editable: !0,
                    listeners: {
                      triggerclick: function(el, trigger, index) {
                        if (index == 0) el.setValue("");
                        else {
                          el.propertyType = record.get("属性类型");
                          var config = {
                            id: el.id,
                            boName: el.propertyType,
                            component: el,
                            multiSelect: dtype == "array",
                            rowdblselect: function() {
                              var selModel = config[Util.id(config.gridId)].selModel,
                                records = selModel.getSelection(),
                                lastRecords = selModel.getLastSelected(),
                                ds = [],
                                d, recordItem, showProperty = record.get("属性类型显示属性") || Config.id,
                                i, ln;
                              if (lastRecords && records.indexOf(lastRecords) == -1 && records.push(lastRecords), records.length == 0) {
                                Msg.Normal("请选择..");
                                return
                              }
                              for (i = 0, ln = records.length; i < ln; i++) recordItem = records[i], d = {}, d[Config.id] = recordItem.get(Config.id), d[showProperty] = recordItem.get(showProperty) || "", ds.push(d);
                              config.multiSelect ? record.set("属性默认值", Ext.encode(ds).replace(/"/g, "'")) : record.set("属性默认值", Ext.encode(ds[0]).replace(/"/g, "'")), Util.WindowHideOrClose(config.win, config)
                            },
                            select: function() {
                              config[Util.id(config.gridId)].fireEvent("itemdblclick")
                            }
                          };
                          config.win = Snmon.query.Query(config), Ext.isEmptyObject(config.win.config) && (config.win.config = config), config.win.config[Util.id(config.win.config.gridId)].store.loadPage(1)
                        }
                      }
                    }
                  });
                  break;
                default:
                  field = Snmon.field.Text({
                    hideLabel: !1
                  })
              }
              e.column.setEditor(field)
            }
          }
        },
        OnCondition: function(el) {
          var win, record, grid;
          win = Util.getCmp("WindowCondition"), win || (win = Ext.create("Snmon.query.WindowCondition", {
            listeners: {
              confirm: function(win, grid) {
                var record = Util.getCmp(win.gridId).selModel.getLastSelected();
                record.set("数据控制规则字符", grid.GetSql()), record.set("数据控制规则结构存储", escape(Ext.encode(grid.GetItems()))), record.set("数据控制关联查询字符", grid.GetIncludeField()), record = null
              }
            }
          })), grid = Util.getCmp(el.panelId), record = grid.selModel.getLastSelected(), win.gridId = grid.id, win.SetTypeName(record.raw.属性类型), win.show(), record.data.数据控制规则结构存储 ? win.items.items[0].store.loadData(Ext.decode(unescape(record.data.数据控制规则结构存储))) : win.items.items[0].store.loadData([]), win = record = null
        },
        OnConditionForm: function(el, trigger, index) {
          if (index == 0) el.clientdata = "", el.clientsql = "", el.clientinclude = "", el.setValue("");
          else {
            var win, record, treeOperation;
            if (treeOperation = Util.getCmp("Tree_TreeOperation"), record = treeOperation.selModel.getLastFocused(), !record || !record.isLeaf()) return;
            win = Util.getCmp("WindowConditionForm"), win || (win = Ext.create("Snmon.query.WindowCondition", {
              rawId: "WindowConditionForm",
              listeners: {
                confirm: function(win, grid) {
                  var sql = grid.GetSql(!1);
                  el.clientdata = escape(Ext.encode(grid.GetItems())), el.clientsql = Ext.htmlEncode(sql), el.clientinclude = grid.GetIncludeField(), el.setValue(sql)
                }
              }
            })), win.SetTypeName(record.raw.业务名称), win.show(), el.clientdata ? win.items.items[0].store.loadData(Ext.decode(unescape(el.clientdata))) : win.items.items[0].store.loadData([]), win = record = null
          }
        }
      },
      Button: {
        OnSaveClick: function() {
          var selectedOperation = Util.getCmp("Tree_TreeOperation").selModel.getLastFocused(),
            selectedRole = Util.getCmp("Tree_TreeRole").selModel.getLastFocused(),
            d;
          selectedOperation && selectedRole ? (d = Snmon.OperationPowerInstall.Common.PackageData(), d && Snmon.OperationPowerInstall.Service.OperationPowerSave(d)) : Msg.Normal("请选择业务信息和角色信息!")
        },
        OnDeleteClick: function() {
          Msg.Confirm("确认删除?", function(btnText) {
            var treeRole, recordRoles, roleIds;
            if (btnText == "ok") {
              if (treeRole = Util.getCmp("Tree_TreeRole"), recordRoles = treeRole.getChecked(), recordRoles.length == 0) return !1;
              roleIds = [], Ext.each(recordRoles, function(item) {
                roleIds.push(item.get("id"))
              }), Snmon.OperationPowerInstall.Service.OperationPowerDelete(roleIds.join(","))
            }
          })
        },
        OnCopyClick: function() {
          var treeRole = Util.getCmp("Tree_TreeRole"),
            recordRoles = treeRole.getChecked();
          if (recordRoles.length == 0) return !1;
          Snmon.window.TreeWindow({
            id: "Role",
            boName: "角色",
            rootVisible: !1,
            extraParams: {
              sign: "FindTree",
              treeBoName: "角色",
              expandHandler: !0,
              noChecked: !0,
              sql: ""
            },
            beforeload: function(store) {
              var roleIds = [];
              Ext.each(recordRoles, function(item) {
                roleIds.push("ID!='" + item.get("id") + "'")
              }), store.setExtraParams("sql", roleIds.join(" and "))
            },
            itemdblclick: function(view, record) {
              Msg.Confirm("拷贝将改变原来角色的权限,确认拷贝?", function(btn) {
                if (btn == "ok") {
                  var roleIds = [];
                  Ext.each(treeRole.getChecked(), function(item) {
                    roleIds.push(item.get("id"))
                  }), Snmon.OperationPowerInstall.Service.OperationPowerCopy(roleIds.join(","), record.get("id"))
                }
              })
            }
          })
        },
        OnPartCopyClick: function() {
          var treeRole, treeOperation, recordRoles, recordOperations;
          if (treeRole = Util.getCmp("Tree_TreeRole"), treeOperation = Util.getCmp("Tree_TreeOperation"), recordRoles = treeRole.getChecked(), recordOperations = treeOperation.getChecked(), recordRoles.length == 0 || recordOperations.length == 0) return !1;
          Snmon.window.TreeWindow({
            id: "Role2",
            boName: "角色",
            rootVisible: !1,
            extraParams: {
              sign: "FindTree",
              treeBoName: "角色",
              expandHandler: !0,
              noChecked: !0,
              sql: ""
            },
            beforeload: function(store) {
              var roleIds = [];
              Ext.each(treeRole.getChecked(), function(item) {
                roleIds.push("ID!='" + item.get("id") + "'")
              }), store.setExtraParams("sql", roleIds.join(" and "))
            },
            itemdblclick: function(view, record) {
              Msg.Confirm("拷贝将改变原来角色的权限,确认拷贝?", function(btn) {
                if (btn == "ok") {
                  var roleIds = [],
                    operationIds = [];
                  Ext.each(treeRole.getChecked(), function(item) {
                    roleIds.push(item.get("id"))
                  }), Ext.each(treeOperation.getChecked(), function(item) {
                    operationIds.push(item.get("id"))
                  }), Snmon.OperationPowerInstall.Service.OperationPowerCopy(roleIds.join(","), record.get("id"), operationIds.join(","))
                }
              })
            }
          })
        }
      },
      Tree: {
        OnNodeItemClick: function(view, record, item, index, e) {
          if (e && e.target.nodeName != "INPUT") {
            var selectedOperation = Util.getCmp("Tree_TreeOperation").selModel.getLastFocused(),
              selectedRole = Util.getCmp("Tree_TreeRole").selModel.getLastFocused();
            selectedOperation && selectedOperation.get("leaf") && selectedRole && !selectedRole.get("root") ? Snmon.OperationPowerInstall.Service.GetOperationPowerByOperation(selectedOperation.raw.业务名称, selectedRole.get("id")) : (Snmon.OperationPowerInstall.PanelData = null, Util.getCmp("GridToolbarPower").store.removeAll(), Snmon.OperationPowerInstall.Common.移除列表控件())
          }
        }
      }
    },
    Service: {
      OperationPowerSave: function(data) {
        var me = this,
          mask = new Ext.LoadMask(Ext.getBody(), {
            msg: "保存中,请稍等..."
          });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/OperationPowerInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "OperationPowerSave",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("保存成功!", function() {
              var selectedOperation, selectedRole;
              selectedOperation = Util.getCmp("Tree_TreeOperation").selModel.getLastFocused(), selectedRole = Util.getCmp("Tree_TreeRole").selModel.getLastFocused(), Snmon.OperationPowerInstall.Service.GetOperationPowerByOperation(selectedOperation.raw.业务名称, selectedRole.get("id"))
            }) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: me
        })
      },
      OperationPowerDelete: function(data) {
        var me = this,
          mask = new Ext.LoadMask(Ext.getBody(), {
            msg: "删除中,请稍等..."
          });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/OperationPowerInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "OperationPowerDelete",
            data: data,
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            result == "OK" ? Msg.Normal("删除成功!", function() {
              var selectedOperation, selectedRole;
              selectedOperation = Util.getCmp("Tree_TreeOperation").selModel.getLastFocused(), selectedRole = Util.getCmp("Tree_TreeRole").selModel.getLastFocused(), selectedOperation && selectedRole && Snmon.OperationPowerInstall.Service.GetOperationPowerByOperation(selectedOperation.raw.业务名称, selectedRole.get("id"))
            }) : Msg.Normal(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: me
        })
      },
      GetOperationPowerByOperation: function(boName, roleId) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "加载中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/OperationPowerInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "GetOperationPowerByOperation",
            boName: boName,
            roleId: roleId,
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 && result != "NO" ? Snmon.OperationPowerInstall.Common.数据加载(Ext.decode(result)) : Msg.Question("没有设置默认业务对象权限")
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      OperationPowerCopy: function(roleId, copyRoleId, operationId) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "处理中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/OperationPowerInstallHandler.ashx",
          method: "POST",
          params: {
            sign: "OperationPowerCopy" + (operationId ? "2" : ""),
            roleId: roleId,
            operationId: operationId,
            copyRoleId: copyRoleId,
            page: Util.getPageName()
          },
          success: function(r) {
            var result, win;
            mask.hide(), result = r.responseText, r.status == 200 && result == "OK" ? (win = Util.getCmp("TreeWindow_Role" + (operationId ? "2" : "")), win && win.hide(), Msg.Normal("完成拷贝!")) : Msg.Question(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.RecycleAndDraftBin = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {
        var toolbarButtons = [],
          grid, boName = Snmon.RecycleAndDraftBin.boName,
          pre = Snmon.RecycleAndDraftBin.Service;
        toolbarButtons = this.CreateToolbarButton(), boName == "回收站" && toolbarButtons.push({
          id: Util.id("ButtonRestore"),
          xtype: "button",
          text: "还原",
          iconCls: "icon-restore",
          disabled: !0,
          handler: pre.交互选择项数据
        }), toolbarButtons.push({
          id: Util.id("ButtonQuery"),
          xtype: "button",
          text: "查询",
          iconCls: "icon-query",
          handler: function(btn) {
            Util.列表查询({
              buttonId: btn.id,
              gridId: "Grid"
            })
          }
        }), toolbarButtons.push({
          xtype: "button",
          text: "刷新",
          iconCls: "icon-refresh",
          scope: this,
          handler: Util.PageRefresh
        }), grid = this.CreateGrid(boName), grid.region = "center", Util.AddMainPanel([grid], toolbarButtons)
      },
      CreateToolbarButton: function() {
        return [{
          id: Util.id("ButtonView"),
          xtype: "button",
          text: "查看",
          iconCls: "icon-view",
          disabled: !0,
          handler: Snmon.RecycleAndDraftBin.Event.OnClickView
        }, {
          id: Util.id("ButtonDelete"),
          xtype: "button",
          text: "删除",
          iconCls: "icon-delete",
          disabled: !0,
          handler: Snmon.RecycleAndDraftBin.Service.交互选择项数据
        }]
      },
      CreateGrid: function(boName) {
        return Util.CreateGrid({
          gridId: "Grid",
          isColumnColor: !1,
          addRow: !1,
          delRow: !1,
          multiSelect: !0,
          canEditor: !1,
          paging: !0,
          boName: boName,
          extraParams: {
            Type: escape("获取列表信息"),
            Flag: escape(boName)
          },
          url: "WebServices/System/RecycleAndDraftBinHandler.ashx"
        })
      }
    },
    Common: {},
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {
          var grid = Util.getCmp("Grid"),
            selModel, store, btnQuery = Util.getCmp("ButtonQuery");
          if (grid) {
            selModel = grid.selModel, store = grid.store, store.load();
            selModel.on("select", this.OnRowSelectOrDeselect);
            selModel.on("deselect", this.OnRowSelectOrDeselect)
          }
        },
        OnRowSelectOrDeselect: function(rowModel) {
          var btnDel = Util.getCmp("ButtonDelete"),
            btnView = Util.getCmp("ButtonView"),
            btnRestore = Util.getCmp("ButtonRestore"),
            length = rowModel.getSelection().length;
          switch (length) {
            case 0:
              btnDel && btnDel.disable(), btnRestore && btnRestore.disable(), btnView && btnView.disable();
              break;
            case 1:
              btnDel && btnDel.enable(), btnRestore && btnRestore.enable(), btnView && btnView.enable();
              break;
            default:
              btnView && btnView.disable()
          }
        }
      },
      OnClickView: function() {
        Msg.Normal("功能待实现!")
      }
    },
    Service: {
      "交互选择项数据": function(button) {
        var grid = Util.getCmp("Grid"),
          type = button.id == Util.id("ButtonDelete") ? "删除" : "还原",
          data = Snmon.RecycleAndDraftBin.Service.打包列表数据(),
          myMask = new Ext.LoadMask(Ext.getBody(), {
            msg: "正在" + type + "数据,请稍等..."
          });
        myMask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/RecycleAndDraftBinHandler.ashx",
          success: function(r) {
            myMask.hide();
            var result = r.responseText,
              grid = Util.getCmp("Grid");
            r.status == 200 && result && result === "OK" ? (Msg.Normal(type + "成功!"), grid.store.load(), Snmon.RecycleAndDraftBin.Event.AfterEvent.OnRowSelectOrDeselect(grid.selModel)) : Msg.Error(result)
          },
          failure: function(r) {
            myMask.hide(), Msg.Failure(r.responseText)
          },
          params: {
            Type: escape(grid.boName + "交互选择项数据"),
            Data: escape(Ext.encode(data)),
            Flag: escape(type)
          }
        })
      },
      "打包列表数据": function() {
        var grid = Util.getCmp("Grid"),
          items, item, data = {},
          dataArray = [],
          i, length;
        if (grid)
          for (items = grid.selModel.getSelection(), i = 0, length = items.length; i < length; i++) item = Ext.apply(items[i].raw || {}, items[i].data), dataArray.push(item);
        return data[grid.boName] = dataArray, data
      }
    }
  }
}(),
function() {
  Snmon.ReportFormsTemplate = {
    Load: function() {
      this.Event.BeforeEvent.Init(), ListPage.Render({
        buttons: ["Add", "Modify", "Delete", "Query", "Refresh"]
      }), this.Event.AfterEvent.Init()
    },
    Render: {},
    Common: {
      WinShow: function() {
        var storeBusinessName = Snmon.data.Store({
            id: "StoreBusinessName",
            boName: "业务对象信息",
            extraParams: {
              sign: "Find",
              dataShowWay: "查询展示",
              boName: "业务对象信息",
              cName: "",
              method: "Excel模板.得到需要设置的类型"
            },
            items: [{
              property: "ID",
              type: "string"
            }, {
              property: "名称",
              type: "string"
            }]
          }),
          storeType = Snmon.data.Store({
            id: "StoreType",
            boName: "Excel模板类型",
            extraParams: {
              sign: "Find",
              dataShowWay: "查询展示",
              boName: "Excel模板类型",
              cName: ""
            },
            items: [{
              property: "ID",
              type: "string"
            }, {
              property: "名称",
              type: "string"
            }]
          }),
          win = Ext.create("widget.window", {
            id: "WindowTemplate",
            width: 400,
            title: "报表模板",
            layout: "fit",
            items: {
              xtype: "form",
              frame: !0,
              defaultType: "textfield",
              defaults: {
                anchor: "100%",
                msgTarget: "side",
                labelWidth: 80
              },
              items: [{
                xtype: "hiddenfield",
                id: Util.id("TID"),
                name: "ID"
              }, {
                xtype: "hiddenfield",
                id: Util.id("TypeID"),
                name: "TypeID"
              }, {
                xtype: "combobox",
                fieldLabel: "业务名称",
                store: storeBusinessName,
                displayField: "名称",
                valueField: "名称",
                id: Util.id("BusinessName"),
                name: "BusinessName",
                allowBlank: !1
              }, {
                xtype: "combobox",
                fieldLabel: "模板类型",
                displayField: "名称",
                valueField: "ID",
                store: storeType,
                id: Util.id("TempType"),
                allowBlank: !1,
                listeners: {
                  change: {
                    fn: function(field, newValue) {
                      newValue && newValue.indexOf("-") != -1 && Util.getCmp("TypeID").setValue(newValue)
                    }
                  }
                }
              }, {
                fieldLabel: "模板名",
                id: Util.id("TempName"),
                name: "TempName"
              }, {
                xtype: "filefield",
                fieldLabel: "模板",
                id: Util.id("Temp"),
                buttonText: "浏览",
                name: "Temp",
                allowBlank: !1
              }, {
                fieldLabel: "模板密码",
                id: Util.id("TempPwd"),
                name: "TempPwd"
              }, {
                xtype: "numberfield",
                fieldLabel: "分录数量",
                id: Util.id("Number"),
                name: "Number",
                minValue: 0
              }, {
                fieldLabel: "分录属性名",
                id: Util.id("Property"),
                name: "Property"
              }],
              buttons: [{
                text: "提交",
                handler: function() {
                  var id = Util.getCmp("TID").getValue(),
                    excelTemp = Util.getCmp("Temp").getValue(),
                    excelNumber = Util.getCmp("Number").getValue(),
                    extension, form;
                  if (!excelTemp && !id) {
                    Msg.Normal("请选择模板...");
                    return
                  }
                  if (excelNumber && excelNumber < 0) {
                    Msg.Normal("分录数量不小于0!");
                    return
                  }
                  if (extension = excelTemp.substring(excelTemp.lastIndexOf(".")), [".xls", ".xlsx", ".doc", ".docx"].indexOf(extension) == -1 && !id) {
                    Msg.Normal("请选择模板...");
                    return
                  }
                  form = this.up("form").getForm(), form.isValid() && form.submit({
                    waitTitle: "请稍等...",
                    url: "/WebServices/System/TemplateUpload.ashx?sign=TemplateUpload",
                    waitMsg: "正在保存,请稍等...",
                    success: function() {
                      win.close()
                    },
                    failure: function(form, action) {
                      var result = action.result;
                      result && result.Result == "OK" ? (Msg.Normal("保存成功!"), Util.getCmp("Grid").store.loadPage(1)) : result ? Msg.Normal(result.Result) : Msg.Normal("保存失败!"), win.close()
                    }
                  })
                }
              }, {
                text: "取消",
                handler: function() {
                  this.up("form").getForm().reset(), win.close()
                }
              }]
            }
          });
        win.show()
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {
          Util.OnComponent("clientincolumncreate", function(config, item) {
            item.property == "模板名" && (item.renderer = function(value, metaData, record) {
              var raw = record.raw,
                href = Config.VPath + "WebServices/Common/Download.ashx?sign=ExcelTempDowload";
              return href += "&id=" + raw.ID, href += "&postfix=" + raw.模板后缀名, href += "&tempname=" + escape(raw.模板名), '<a style="color:blue;" href="javascript:void(0)" onclick=Util.文件下载(\'' + href + "')>" + value + "<\/a>"
            })
          })
        }
      },
      AfterEvent: {
        Init: function() {
          var btnAdd = Util.getCmp("ButtonAdd"),
            btnModify = Util.getCmp("ButtonModify");
          btnAdd.on("clientbeforeclick", function() {
            return Snmon.ReportFormsTemplate.Common.WinShow(), !1
          });
          btnModify.on("clientbeforeclick", function() {
            Snmon.ReportFormsTemplate.Common.WinShow();
            var id = Util.getCmp("TID"),
              bName = Util.getCmp("BusinessName"),
              tempType = Util.getCmp("TempType"),
              typeId = Util.getCmp("TypeID"),
              tempName = Util.getCmp("TempName"),
              tempPwd = Util.getCmp("TempPwd"),
              number = Util.getCmp("Number"),
              property = Util.getCmp("Property"),
              grid = Util.getCmp("Grid"),
              raw = grid.selModel.getLastSelected().raw;
            return id.setValue(raw.ID), bName.setValue(raw.业务对象名), tempType.setValue(raw.模板类型.名称), typeId.setValue(raw.模板类型ID), tempName.setValue(raw.模板名), tempPwd.setValue(raw.模板修改密码), number.setValue(raw.打印分录数量), property.setValue(raw.打印分录属性名), !1
          })
        }
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.ReportPower = {
    PanelData: null,
    Load: function() {
      this.Event.Before.Init(), this.Render.Init(), this.Event.After.Init()
    },
    Render: {
      Init: function() {
        var treeOperation, treeRole, formPower, grid;
        treeOperation = this.GetTreeOperation(), treeRole = this.GetTreeRole(), formPower = this.GetFormPower(), grid = this.GetGridPropertyPower(), Util.AddMainPanel([{
          width: 500,
          region: "west",
          layout: "border",
          layout: {
            type: "hbox",
            align: "stretch"
          },
          bodyStyle: "border:0px;",
          items: [treeRole, treeOperation]
        }, {
          region: "center",
          layout: "border",
          bodyStyle: "border:0px;",
          items: [{
            id: Util.id("TabForm"),
            xtype: "tabpanel",
            region: "center",
            bodyStyle: "border-top:0px;",
            items: [formPower, grid]
          }]
        }], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: Snmon.ReportPower.Event.Button.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonCopy"),
          text: "权限拷贝",
          iconCls: "icon-save",
          handler: Snmon.ReportPower.Event.Button.OnCopyClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }])
      },
      GetFormPower: function() {
        return Ext.create("Ext.form.Panel", {
          xtype: "form",
          id: Util.id("FormPower"),
          bodyPadding: 5,
          title: "报表数据权限",
          layout: {
            type: "table",
            columns: 1
          },
          items: [{
            id: Util.id("Panel_数据权限"),
            fieldLabel: "数据权限",
            xtype: "combo",
            labelSeparator: "",
            editable: !1,
            queryMode: "local",
            store: Snmon.ReportPowerItems
          }, {
            id: Util.id("Panel_权限控制属性"),
            fieldLabel: "权限控制属性",
            xtype: "combo",
            labelSeparator: "",
            editable: !1,
            queryMode: "local",
            store: []
          }, {
            id: Util.id("Panel_数据控制规则字符"),
            fieldLabel: "数据控制规则字符",
            xtype: "triggerfield",
            labelAlign: "right",
            labelSeparator: "",
            ctype: "expand",
            editable: !1,
            width: 450,
            trigger1Cls: "x-form-clear-trigger",
            trigger2Cls: "x-form-elp-trigger",
            listeners: {
              triggerclick: Snmon.ReportPower.Event.After.OnConditionForm
            }
          }]
        })
      },
      GetTreeOperation: function() {
        return Snmon.tree.Tree({
          id: "TreeOperation",
          region: "west",
          title: "业务信息",
          rootVisible: !1,
          width: 250,
          bodyStyle: "0px",
          boName: "业务对象信息",
          extraParams: {
            sign: "FindTree",
            treeBoName: "业务对象信息",
            expandHandler: !0
          },
          rootText: "业务对象",
          itemclick: Snmon.ReportPower.Event.Tree.OnNodeItemClick
        })
      },
      GetTreeRole: function() {
        return Snmon.tree.Tree({
          id: "TreeRole",
          region: "west",
          title: "角色信息",
          rootVisible: !1,
          width: 250,
          bodyStyle: "0px",
          boName: "角色信息",
          extraParams: {
            sign: "FindTree",
            treeBoName: "角色",
            expandHandler: !0
          },
          rootText: "角色",
          itemclick: Snmon.ReportPower.Event.Tree.OnNodeItemClick
        })
      },
      GetGridPropertyPower: function() {
        return Snmon.grid.Grid({
          id: "Grid",
          title: "属性权限",
          config: !1,
          addRow: !1,
          delRow: !1,
          copyRow: !1,
          canEditor: !0,
          multiSelect: !1,
          boName: "报表属性权限",
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性类型",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性名称",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "属性权限",
            property: "属性权限状态",
            width: 65,
            dataType: "string",
            allowBlank: !1,
            store: Snmon.PropertyPower,
            componentType: "下拉扩展控件"
          }, {
            fieldLabel: "属性类型",
            width: 100,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件"
          }, {
            fieldLabel: "属性默认值",
            width: 120,
            dataType: "string",
            allowBlank: !0,
            componentType: "文本控件"
          }, {
            fieldLabel: "数据控制规则字符",
            width: 200,
            dataType: "string",
            allowBlank: !0,
            componentType: "扩展控件"
          }, {
            fieldLabel: "数据控制规则结构存储",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "数据控制关联查询字符",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "属性类型显示属性",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "数据类型",
            dataType: "string",
            configType: "展示隐藏"
          }]
        })
      }
    },
    Common: {
      "打包列表数据": function(grid, headId, datas, boName) {
        var items, data, item, i, ln;
        if (!grid) return !1;
        for (items = grid.store.data.items, i = 0, ln = items.length; i < ln; i++) {
          if (item = items[i], Snmon.data.列表行数据验证和提示(item, i) === !1) return !1;
          data = Ext.apply(item.raw || {}, item.data), data.分组名 = boName, data[Config.headId] = headId, data[Config.OperateState] = !data[Config.OperateState] || data[Config.OperateState] == Config.EmptyGuid ? Config.Add : Config.Modify, datas.push(data)
        }
      },
      PackageData: function() {
        var data = Snmon.ReportPower.PanelData || {},
          d, _数据控制规则字符Cmp, gridData = [];
        return (_数据控制规则字符Cmp = Util.getPanelCmp("数据控制规则字符"), data.报表数据权限 = data.报表数据权限 || {}, d = data.报表数据权限, d.ID || (d.ID = Util.NewGuid()), d.数据权限 = Util.getPanelCmp("数据权限").getValue(), d.权限控制属性 = Util.getPanelCmp("权限控制属性").getValue(), d.角色ID = Snmon.ReportPower.RoleId, d.报表对象名称 = Snmon.ReportPower.Operation, d.数据控制规则字符 = _数据控制规则字符Cmp.clientsql, d.数据控制规则结构存储 = _数据控制规则字符Cmp.clientdata, d[Config.OperateState] = d.版本戳 ? Config.Modify : Config.Add, flag = this.打包列表数据(Util.getCmp("Grid"), d[Config.id], gridData), flag === !1) ? !1 : (d.报表属性权限列表 = gridData, data)
      },
      "数据加载": function(data) {
        var _数据权限Cmp, _权限控制属性Cmp, _数据控制规则字符Cmp, _报表数据权限, grid;
        _数据权限Cmp = Util.getPanelCmp("数据权限"), _权限控制属性Cmp = Util.getPanelCmp("权限控制属性"), _数据控制规则字符Cmp = Util.getPanelCmp("数据控制规则字符"), _权限控制属性Cmp.store.loadData(data.Propertys), data.Panel ? (Snmon.ReportPower.PanelData = data.Panel, _报表数据权限 = data.Panel.报表数据权限, _数据权限Cmp.setValue(_报表数据权限.数据权限), _权限控制属性Cmp.setValue(_报表数据权限.权限控制属性), _数据控制规则字符Cmp.setValue(Ext.htmlDecode(_报表数据权限.数据控制规则字符)), _数据控制规则字符Cmp.clientsql = _报表数据权限.数据控制规则字符, _数据控制规则字符Cmp.clientdata = _报表数据权限.数据控制规则结构存储) : (_数据权限Cmp.setValue(""), _权限控制属性Cmp.setValue(""), _数据控制规则字符Cmp.setValue(""), _数据控制规则字符Cmp.clientsql = "", _数据控制规则字符Cmp.clientdata = "", Snmon.ReportPower.PanelData = null), grid = Util.getCmp("Grid"), grid.store.loadRawData(data.Grid)
      }
    },
    Event: {
      Before: {
        Init: function() {}
      },
      After: {
        Init: function() {
          var _数据控制规则字符Cmp;
          this.Grid.Init(), _数据控制规则字符Cmp = Util.getCmp("Grid_数据控制规则字符");
          _数据控制规则字符Cmp.on("clientshow", this.OnCondition, this);
          _数据控制规则字符Cmp.on("clientclear", this.On数据控制规则字符Clear, this)
        },
        OnConditionForm: function(el, trigger, index) {
          if (index == 0) el.clientdata = "", el.clientsql = "", el.setValue("");
          else {
            var win, recordRole, recordOperation, treeRole, treeOperation;
            if (treeRole = Util.getCmp("Tree_TreeRole"), recordRole = treeRole.selModel.getLastFocused(), treeOperation = Util.getCmp("Tree_TreeOperation"), recordOperation = treeOperation.selModel.getLastFocused(), !recordRole || !recordOperation || !recordOperation.isLeaf()) return;
            win = Util.getCmp("WindowConditionForm"), win || (win = Ext.create("Snmon.query.WindowCondition", {
              rawId: "WindowConditionForm",
              listeners: {
                confirm: function(win, grid) {
                  var sql = grid.GetSql(!1);
                  el.clientdata = escape(Ext.encode(grid.GetItems())), el.clientsql = Ext.htmlEncode(sql), el.setValue(sql)
                }
              }
            })), win.SetTypeName(recordOperation.raw.id), win.show(), el.clientdata ? win.items.items[0].store.loadData(Ext.decode(unescape(el.clientdata))) : win.items.items[0].store.loadData([]), win = record = null
          }
        },
        "On数据控制规则字符Clear": function() {
          var grid;
          grid = Util.getCmp("Grid"), grid.selModel.getLastSelected().set("数据控制规则字符", "")
        },
        Grid: {
          Init: function() {
            var grid = Util.getCmp("Grid");
            grid.on("beforeedit", this.OnGridBeforeEdit, this);
            grid.on("edit", this.OnGridEdit, this)
          },
          OnGridBeforeEdit: function(editor, e) {
            var field, record, items;
            if (field = e.field, record = e.record, ["属性名称", "按钮名称", "方法名称", "属性类型"].indexOf(field) != -1) return !1;
            if (["权限控制属性", "数据权限", "数据控制规则"].indexOf(field) != -1) {
              if (field == "数据权限" && record.raw.是否区域部门) return !0;
              if (record.get("属性类型") && (field != "数据权限" || record.get("权限控制属性")) && (field != "权限控制属性" || !record.raw.是否区域部门)) items = [], Ext.each(Ext.decode(record.raw.待控制属性集合), function(item) {
                items.push({
                  id: item,
                  field1: item
                })
              }), Util.getCmp(e.grid.id + "_权限控制属性").store.loadData(items);
              else return !1
            } else if (field == "数据控制规则字符") return record.raw.属性类型 ? !0 : !1;
            this.默认值的编辑(editor, e)
          },
          OnGridEdit: function(editor, e) {
            var field, record;
            field = e.field, record = e.record, field == "权限控制属性" && !record.get("数据权限") && e.value ? record.set("数据权限", "查看所有级别") : e.value || field != "权限控制属性" || record.set("数据权限", "")
          },
          "默认值的编辑": function(editor, e) {
            if (e.field == "属性默认值") {
              var record = e.record,
                dtype = record.get("数据类型"),
                field;
              switch (dtype) {
                case "int":
                case "float":
                  field = Snmon.field.Number({
                    hideLabel: !1
                  });
                  break;
                case "object":
                  field = Ext.form.field.Trigger({
                    id: Util.id("Query_" + record.get("属性名称").replace(/\./g, "_")),
                    xtype: "triggerfield",
                    trigger1Cls: "x-form-clear-trigger",
                    trigger2Cls: "x-form-elp-trigger",
                    hideLabel: !1,
                    editable: !0,
                    listeners: {
                      triggerclick: function(el, trigger, index) {
                        if (index == 0) el.setValue("");
                        else {
                          el.propertyType = record.get("属性类型");
                          var config = {
                            id: el.id,
                            boName: el.propertyType,
                            component: el,
                            multiSelect: dtype == "array",
                            rowdblselect: function() {
                              var selModel = config[Util.id(config.gridId)].selModel,
                                records = selModel.getSelection(),
                                lastRecords = selModel.getLastSelected(),
                                ds = [],
                                d, recordItem, showProperty = record.get("属性类型显示属性") || Config.id,
                                i, ln;
                              if (lastRecords && records.indexOf(lastRecords) == -1 && records.push(lastRecords), records.length == 0) {
                                Msg.Normal("请选择..");
                                return
                              }
                              for (i = 0, ln = records.length; i < ln; i++) recordItem = records[i], d = {}, d[Config.id] = recordItem.get(Config.id), d[showProperty] = recordItem.get(showProperty) || "", ds.push(d);
                              config.multiSelect ? record.set("属性默认值", Ext.encode(ds).replace(/"/g, "'")) : record.set("属性默认值", Ext.encode(ds[0]).replace(/"/g, "'")), Util.WindowHideOrClose(config.win, config)
                            },
                            select: function() {
                              config[Util.id(config.gridId)].fireEvent("itemdblclick")
                            }
                          };
                          config.win = Snmon.query.Query(config), Ext.isEmptyObject(config.win.config) && (config.win.config = config), config.win.config[Util.id(config.win.config.gridId)].store.loadPage(1)
                        }
                      }
                    }
                  });
                  break;
                default:
                  field = Snmon.field.Text({
                    hideLabel: !1
                  })
              }
              e.column.setEditor(field)
            }
          }
        },
        OnCondition: function(el) {
          var win, record, grid;
          win = Util.getCmp("WindowCondition"), win || (win = Ext.create("Snmon.query.WindowCondition", {
            listeners: {
              confirm: function(win, grid) {
                var record = Util.getCmp(win.gridId).selModel.getLastSelected();
                record.set("数据控制规则字符", grid.GetSql()), record.set("数据控制规则结构存储", escape(Ext.encode(grid.GetItems()))), record.set("数据控制关联查询字符", grid.GetIncludeField()), record = null
              }
            }
          })), grid = Util.getCmp(el.panelId), record = grid.selModel.getLastSelected(), win.gridId = grid.id, win.SetTypeName(record.raw.属性类型), win.show(), record.data.数据控制规则结构存储 ? win.items.items[0].store.loadData(Ext.decode(unescape(record.data.数据控制规则结构存储))) : win.items.items[0].store.loadData([]), win = record = null
        }
      },
      Button: {
        OnSaveClick: function() {
          var selectedOperation = Util.getCmp("Tree_TreeOperation").selModel.getLastFocused(),
            selectedRole = Util.getCmp("Tree_TreeRole").selModel.getLastFocused(),
            d;
          selectedOperation && selectedRole ? (d = Snmon.ReportPower.Common.PackageData(), d && Snmon.ReportPower.Service.OperationPowerSave(d)) : Msg.Normal("请选择业务信息和角色信息!")
        },
        OnCopyClick: function() {
          var treeRole = Util.getCmp("Tree_TreeRole"),
            recordRoles = treeRole.getChecked();
          if (recordRoles.length == 0) return !1;
          Snmon.window.TreeWindow({
            id: "Role",
            boName: "角色",
            rootVisible: !1,
            extraParams: {
              sign: "FindTree",
              treeBoName: "角色",
              expandHandler: !0,
              noChecked: !0,
              sql: ""
            },
            beforeload: function(store) {
              var roleIds = [];
              Ext.each(treeRole.getChecked(), function(item) {
                roleIds.push("ID!='" + item.get("id") + "'")
              }), store.setExtraParams("sql", roleIds.join(" and "))
            },
            itemdblclick: function(view, record) {
              Msg.Confirm("拷贝将改变原来角色的权限,确认拷贝?", function(btn) {
                if (btn == "ok") {
                  var roleIds = [];
                  Ext.each(treeRole.getChecked(), function(item) {
                    roleIds.push(item.get("id"))
                  }), Snmon.ReportPower.Service.ReportPowerCopy(roleIds.join(","), record.get("id"))
                }
              })
            }
          })
        }
      },
      Tree: {
        OnNodeItemClick: function(view, record, item, index, e) {
          if (e && e.target.nodeName != "INPUT") {
            var selectedOperation = Util.getCmp("Tree_TreeOperation").selModel.getLastFocused(),
              selectedRole = Util.getCmp("Tree_TreeRole").selModel.getLastFocused();
            selectedOperation && selectedOperation.get("leaf") && selectedRole && !selectedRole.get("root") ? (Snmon.ReportPower.RoleId = selectedRole.get("id"), Snmon.ReportPower.Operation = selectedOperation.get("id"), Snmon.ReportPower.Service.GetReportPowerByOperation(Snmon.ReportPower.Operation, Snmon.ReportPower.RoleId)) : (Snmon.ReportPower.PanelData = null, Snmon.ReportPower.RoleId = null, Snmon.ReportPower.Operation = null)
          }
        }
      }
    },
    Service: {
      OperationPowerSave: function(data) {
        var me = this,
          mask = new Ext.LoadMask(Ext.getBody(), {
            msg: "保存中,请稍等..."
          });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/ReportPowerHandler.ashx",
          method: "POST",
          params: {
            sign: "ReportPowerSave",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("保存成功!", function() {
              Snmon.ReportPower.Service.GetReportPowerByOperation(Snmon.ReportPower.Operation, Snmon.ReportPower.RoleId)
            }) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: me
        })
      },
      ReportPowerCopy: function(roleId, copyRoleId) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "处理中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/ReportPowerHandler.ashx",
          method: "POST",
          params: {
            sign: "ReportPowerCopy",
            roleId: roleId,
            copyRoleId: copyRoleId,
            page: Util.getPageName()
          },
          success: function(r) {
            var result, win;
            mask.hide(), result = r.responseText, r.status == 200 && result == "OK" ? (win = Util.getCmp("TreeWindow_Role"), win && win.hide(), Msg.Normal("完成拷贝!")) : Msg.Question(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      },
      GetReportPowerByOperation: function(boName, roleId) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "加载中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/ReportPowerHandler.ashx",
          method: "POST",
          params: {
            sign: "GetReportPowerByOperation",
            boName: boName,
            roleId: roleId,
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide(), Snmon.ReportPower.Common.数据加载(Ext.decode(r.responseText))
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.SystemArguments = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init(), this.Common.页面加载完成()
    },
    Render: {
      Init: function() {
        var grid = this.GetGrid(),
          tree = this.GetTree();
        Util.AddMainPanel([tree, grid], [{
          componentType: "button",
          id: Util.id("ButtonSave"),
          text: "保存",
          iconCls: "icon-save",
          handler: Snmon.SystemArguments.Event.Button.OnSaveClick
        }, {
          componentType: "button",
          id: Util.id("ButtonRefresh"),
          text: "刷新",
          iconCls: "icon-refresh",
          handler: Util.PageRefresh
        }, {
          componentType: "button",
          id: Util.id("ButtonHelp"),
          text: "帮助",
          iconCls: "icon-help",
          handler: Util.OperateHelp
        }])
      },
      GetGrid: function() {
        var grid = Snmon.grid.Grid({
          id: "Grid",
          autoLoad: !1,
          region: "center",
          config: !1,
          paging: !1,
          canEditor: !0,
          url: "WebServices/System/SystemArgumentsHandler.ashx",
          extraParams: {
            sign: "Find",
            page: Util.getPageName()
          },
          items: [{
            fieldLabel: "ID",
            dataType: "string",
            configType: "展示隐藏"
          }, {
            fieldLabel: "顺序",
            property: "序号",
            width: 50,
            dataType: "int",
            allowBlank: !1,
            componentType: "数值控件"
          }, {
            fieldLabel: "名称",
            width: 120,
            dataType: "string",
            allowBlank: !1,
            componentType: "文本控件"
          }, {
            fieldLabel: "上级",
            property: "上级",
            width: 120,
            dataType: "string",
            componentType: "树控件",
            showName: "名称"
          }, {
            fieldLabel: "备注",
            width: 120,
            dataType: "string",
            componentType: "文本控件"
          }, {
            fieldLabel: "操作时间",
            width: 120,
            dataType: "string",
            format: "Y-m-d H:i:s",
            componentType: "日期控件"
          }]
        });
        return grid.view.getRowClass = Util.列表行样式, grid
      },
      GetTree: function() {
        return Snmon.tree.Tree({
          id: "Tree",
          title: "",
          region: "west",
          width: 200,
          maxWidth: 150,
          maxWidth: 350,
          itemclick: Snmon.SystemArguments.Event.TreeItemClick,
          url: "WebServices/System/SystemArgumentsHandler.ashx",
          extraParams: {
            sign: "GetTypes",
            page: Util.getPageName()
          },
          rootText: "系统类型"
        })
      }
    },
    Common: {
      PackageData: function() {
        var grid = Util.getCmp("Grid"),
          data = Snmon.data.打包列表数据(grid, !1, !0);
        return data === !1 ? !1 : data[grid.boName].length == 0 ? (Msg.Normal("没有需要保存的数据!"), !1) : data
      },
      "页面加载完成": function() {
        var addRow = Util.getCmp("GridAddRow");
        addRow && addRow.disable()
      }
    },
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {
          var me = this,
            grid = Util.getCmp("Grid");
          grid.on("beforeedit", me.OnGridBeforeEdit, me);
          grid.on("select", me.OnGridSelect, me);
          grid.on("deselect", me.OnGridDeSelect, me);
          grid.store.on("beforeload", me.OnGridStoreBeforeLoad, me);
          grid.view.getRowClass = Util.列表行样式
        },
        OnGridBeforeEdit: function(editor, e) {
          return ["操作人", "操作状态", "操作时间"].indexOf(e.field) != -1 ? !1 : e.field == "上级" && !e.grid.hasSup ? !1 : void 0
        },
        OnGridSelect: function() {
          var delRow = Util.getCmp("GridDelRow");
          delRow && delRow.enable()
        },
        OnGridDeSelect: function() {
          var delRow = Util.getCmp("GridDelRow");
          delRow && delRow.disable()
        },
        OnGridStoreBeforeLoad: function(store) {
          var grid = Util.getCmp("Grid");
          store.setExtraParams("boName", grid.boName)
        }
      },
      Button: {
        OnSaveClick: function() {
          var data = Snmon.SystemArguments.Common.PackageData();
          data !== !1 && Snmon.SystemArguments.Service.SystemArgumentsSave(data)
        }
      },
      TreeItemClick: function(view, record) {
        var grid = Util.getCmp("Grid"),
          addRow = Util.getCmp("GridAddRow"),
          boName = record.get("id"),
          raw = record.raw,
          hasSup = raw.hasSup,
          _上级Con;
        addRow && addRow.enable(), grid.columns[3].setVisible(hasSup), _上级Con = Util.getCmp("Grid_上级"), _上级Con && (_上级Con.propertyType = boName, _上级Con.treeParam = {
          rootId: raw.rootId,
          rootText: raw.rootText
        }), boName && (grid.hasSup = hasSup, grid.boName = boName, grid.store.load())
      }
    },
    Service: {
      SystemArgumentsSave: function(data) {
        var mask = new Ext.LoadMask(Ext.getBody(), {
          msg: "保存中,请稍等..."
        });
        mask.show(), Ext.Ajax.request({
          url: Config.VPath + "WebServices/System/SystemArgumentsHandler.ashx",
          method: "POST",
          params: {
            sign: "SystemArgumentsSave",
            data: Ext.encode(data),
            page: Util.getPageName()
          },
          success: function(r) {
            mask.hide();
            var result = r.responseText;
            r.status == 200 ? result == "OK" ? Msg.Normal("保存成功!", function() {
              Util.getCmp("Grid").store.load()
            }) : Msg.Normal(result) : Msg.Failure(result)
          },
          failure: function(r) {
            mask.hide(), Msg.Failure(r.responseText)
          },
          scope: this
        })
      }
    }
  }
}(),
function() {
  Snmon.UserPasswordInstall = {
    Load: function() {
      this.Event.BeforeEvent.Init(), this.Render.Init(), this.Event.AfterEvent.Init()
    },
    Render: {
      Init: function() {}
    },
    Common: {},
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {}
      }
    },
    Service: {}
  }
}(),
function() {
  Snmon.WorkflowList = {
    Load: function() {
      this.Event.BeforeEvent.Init(), ListPage.Render({
        items: "",
        ShowQuery: !1,
        autoLoad: !0,
        RemoveButtons: ["Modify", "Query"]
      }), this.Event.AfterEvent.Init()
    },
    Common: {},
    Event: {
      BeforeEvent: {
        Init: function() {}
      },
      AfterEvent: {
        Init: function() {
          Util.getCmp("ButtonAdd").on("clientbeforeclick", function() {
            return window.open(Config.VPath + "Workflow/WorkflowDesigner.aspx"), !1
          });
          Util.getCmp("ButtonView").on("clientbeforeclick", function() {
            var record = Util.getCmp("Grid").selModel.getLastSelected();
            return record && window.open(Config.VPath + "Workflow/WorkflowDesigner.aspx?id=" + record.get(Config.id)), !1
          });
          var grid = Util.getCmp("Grid");
          grid.events.itemdblclick = !0;
          grid.on("itemdblclick", function(view, record) {
            window.open(Config.VPath + "Workflow/WorkflowDesigner.aspx?id=" + record.get(Config.id))
          })
        }
      }
    },
    Service: {}
  }
}()